I create, using SAS Guide, one table, but when i try to insert data into the table, i don't have permission. I see the user owner it's different than user who create table.
I create table using this code:
data test.teste;
format idRegistro 4.;
informat idRegistro 4.;
stop;
run;
The user owner should be may user for example test but I see the owner it's the root user.
Can I change the owner user when execute this data procedure?
I change the permition instead of the owner.
After create table you can use one of the options below:
data _null_;
call system("chmod 777 /test/teste.sas7bdat");
run;
OR
x chmod 777 /test/teste.sas7bdat;
Thanks
Related
I am trying to create a view to fetch data from a bucket by excluding certain folders inside S3 on Hive. I was able to successfully create view on Athena, but couldn't do the same on Hive.
Athena View:
CREATE VIEW test
as
SELECT *
FROM TABLE_A
WHERE NOT ("$PATH LIKE '%PASSENGER_DATA%')
AND NOT ("$PATH LIKE '%CUSTOMER_DATA%');
Could you please advise how the same could be achieved on Hive?
You may actually wish to consider moving the data into its own folders. Then you could build them as a table with:
CREATE VIEW TABLE_DATA
as
SELECT *
FROM TABLE_A --("$PATH LIKE '%PASSENGER_DATA%')
UNION
SELECT *
FROM TABLE_B -- ("$PATH LIKE '%CUSTOMER_DATA%');
THis likely will also make your permission issues easier to manage.
And when needed you could easily use one table or both tables.
There isn't the same facility to filter by path. However, depending on what version you are using you could use Ranger to exclude the data so it wasn't shown.
If you must do it by view try using:
CREATE TABLE filter_out [blah blah blah]
LOCATION '%CUSTOMER_DATA%'
SELECT *
FROM TABLE_A
WHERE NOT EXISTS (SELECT ID FROM filter_out WHERE TABLE_A.ID = filter_out.ID)
code screenshot 1
code screenshot 2
I want to read a data set table in on project big query to write in another
project data set in other table but it is working with all users big query data editor role but not with my first project service account with same role
I want to read a data set table in on project big query to write in another
project data set in other table but it is working with all users big query data editor role but not with my first project service account with same role I want to read a data set table in on project big query to write in another
project data set in other table but it is working with all users big query data editor role but not with my first project service account with same role
I have connected to the DB2 database using libname statement and created a table using DATA Step as follows:
libname db2lib db2 user=user pw=pwd database=dbtest schema=schema1;
data db2lib.test_table;
var1 = "1234";
run;
Table got created successfully but nobody else able to run the SELECT query on it.
I know how to grant permissions to the table using PROC SQL execute but is there any way to GRANT privileges as I am connecting to DB2 using LIBNAME.
I am unaware of any DB2 CREATE TABLE options that grant permissions.
However, if there are any, the data set option DBCREATE_TABLE_OPTS= could be specified in your SAS code:
DBCREATE_TABLE_OPTS= Data Set Option
Specifies DBMS-specific syntax to add to the end of the CREATE TABLE statement.
Details
You can use this option to add DBMS-specific clauses at the end of the SQL CREATE TABLE statement. The SAS/ACCESS engine passes the SQL CREATE TABLE statement and its clauses to the DBMS. The DBMS then executes the statement and creates the DBMS table. This option applies only when you are creating a DBMS table by specifying a libref associated with DBMS data.
As you know, the GRANT statement can be issued through The SQL Procedure EXECUTE statement.
Did you know CONNECT can use the existing LIBNAME ?
Proc SQL;
connect using DB2LIB;
execute (
GRANT …
) by DB2LIB;
I have to perform data prediction using SAS Enterprise Miner. SAS only has an option to load a SAS table but the problem is i have a database with two tables that i have to use for the prediction. How do i get the two tables from the database into SAS Enterprise Miner.
I have not used Access or Miner in 10 years. However, I would suggest something like:
Does Access have the concept of a view? If so, then create the view in Access and then just use that.
or
Write a stand alone piece of code that pulls the tables from Access and does the join in SAS. I believe you can do this in Miner. If not, just do it in Enterprise Guide and save the table to a location you can pick it up with Miner.
or
Create a SAS view from the Access database that does the join and use that in Miner. Same as above, just save a view instead of a table -- allows you to update the Access database without having to recreate the table.
After looking into this problem I finally decided to use base SAS to read the database and extract the individual tables, save them into a SAS library, in that way they will be saved on the local drive then i could use them in Enterprise Miner.
/*Create a new library to store converted files*/
libname db 'C:\\Users\\Documents\\Data Sources';
/*import the first table from the database into the newly created library*/
proc import out = db.Table1
datatable = 'Table1'
dbms= ACCESS Replace;
database= "C:\\Users\\Documents\\Data Sources\\DBName.mdb";
usedate=yes;
scantime=no;
dbsaslabel=none;
run;
/*import the second table from the database into the newly created library*/
proc import out = db.Table2
datatable = 'Table2'
dbms= ACCESS Replace;
database= "C:\\Users\\Documents\\Data Sources\\DBName.mdb";
usedate=yes;
scantime=no;
dbsaslabel=none;
run;
%let user=scott;
%let password=tiger;
libname ora oracle user=&user password=&password;
options mprint mlogic symbolgen;
dm log 'clear';
in this way can we provide security to database?
so, i am trying to make security for my connection, if i clear my log that no one can see it.but once i close my sas section the library which i created will be vanished, so, can u please help me to create permanent library in order to make sure there is a connection with oracle after the section has closed.
You can add your libname statement to the autoexec.sas file. Here is how SAS looks for that file if you need to create one.
http://support.sas.com/kb/19/244.html
You can encode the password so you do not have to store it as plain text. Look at PROC PWENCODE -- http://support.sas.com/documentation/cdl/en/secref/66817/HTML/default/viewer.htm#n0dc6in0v7nfain1f2whl6f5x66p.htm
Another way to ensure security of your oracle credentials is to use dbprompt=yes in the LIBNAME statement. In this case you don't need to include your username and password into the statement - they will be prompted (in pop-up window) each time the library is being assigned. Which of course not so convenient, especially if you want this library to be assigned for every session. But security is worth of some sacrifices, I think...
It will work for SAS Base interface, but not for Enterprise Guide (when SAS-server is on the same local machine that EG itself, which is almost always the case): http://support.sas.com/kb/7/980.html
In this situation you can create user prompts using EG functionality (Prompt Manager). These prompts will assign your login and password entered into prompt window to macro variables, which you can then reference to in the LIBNAME statement.