Hi all,
I have a doubt regarding the properties of a table after running a particular data step in the user written code trasnformation of SAS Data Integration Studio.
Supposing that table A is a table created in SAS Data Integration Studio with primary key, indexes, constraints, columns with specific formats and informats,... Does anyone know if we lose these properties after running a step like this?
data A;
set A;
if <condition>;
run;
Thanks,
LF
The code you've posted will create a new table with a name as defined via "DATA A;".
The table in the SET statement will get used for defining the variables for this new table. Indices, constraints and other table attributes won't get replicated.
During data step execution output records will get written to a table with a temporary name (automatically created by SAS).
After successful completion of all data step iterations the table will get renamed to the name as defined in the DATA statement - "A" in your case. This renaming process will replace any already pre-existing same named table with the newly created table (different physical object).
Because any indices and constraints belong to the old same named table, these indices and constraints will get dropped as well.
Using DIS:
Best practice is to use the available transformations as far as possible and to avoid User Written Code. To subset data use the SQL Extract or SQL Delete transformation.
If you really must use User Written Coden then try to incorporate the available macro variables created by the transformation so your code remains at least to a certain degree metadata driven.
The code you've posted will create a new table with a name as defined via "DATA A;".
The table in the SET statement will get used for defining the variables for this new table. Indices, constraints and other table attributes won't get replicated.
During data step execution output records will get written to a table with a temporary name (automatically created by SAS).
After successful completion of all data step iterations the table will get renamed to the name as defined in the DATA statement - "A" in your case. This renaming process will replace any already pre-existing same named table with the newly created table (different physical object).
Because any indices and constraints belong to the old same named table, these indices and constraints will get dropped as well.
Using DIS:
Best practice is to use the available transformations as far as possible and to avoid User Written Code. To subset data use the SQL Extract or SQL Delete transformation.
If you really must use User Written Coden then try to incorporate the available macro variables created by the transformation so your code remains at least to a certain degree metadata driven.
Hi Patrick,
Many thanks for your answer. It was really helpful.
Hi Patrick,
Regarding your answer, a question have came up:
I've tried to use the Delete transformation. However, we don't save space using it. Am I right? It is an issue to me.
Thanks,
LF15
Hi @Patrick,
Maybe it is a redundant question but it has come up: Even if we create a data set with a different name from the one that is in the "set" instruction, we also lose the indexes and constraints information from A, right? I mean:
data B;
set A;
if <condition>;
run;
Thanks,
May15
Hi LinusH,
Thanks. Just one doubt: What does tbke stand for?
Hi LinusH,
Oh ok, now it makes sense
Thanks!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.