SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

SAS DIS - Data steps in user written code

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

SAS DIS - Data steps in user written code

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


Accepted Solutions
Highlighted
Solution
3 weeks ago
Respected Advisor
Posts: 4,132

Re: SAS DIS - Data steps in user written code

[ Edited ]

@LF15

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.

View solution in original post


All Replies
Highlighted
Solution
3 weeks ago
Respected Advisor
Posts: 4,132

Re: SAS DIS - Data steps in user written code

[ Edited ]

@LF15

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.

Occasional Contributor
Posts: 8

Re: SAS DIS - Data steps in user written code

Hi Patrick,

 

Many thanks for your answer. It was really helpful.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 261 views
  • 3 likes
  • 2 in conversation