I need generate some new variables based on a SAS data set.
Except creating user written code, how can I use SAS DI to generate a SAS data step to accomplish the task?
Thanks in advance!
You ae not keen on using 'user written code'?
If your task is fairly typical you can look into 'user written transformation'.
SAS code can also be inserted in the pre and post step sections in every other transformation.
Thank you for your response.
I purposely want to avoid user written code here. I have already created SAS code in EG, and now I am re-do the work in DI.
I want take advantage on the metadata generated by DI, and this is why I try to avoid user written code.
You will need to be more specific in what you have and what you want in order to give you an explicit answer.
On a general level:
There are multiple ways of creating additional variables in an target table based on variables in a source table. You could for example use an Extract or SQL Join tranformation, then add the variables to the target table and then in the mapping tab of the transformation map variables from source to target and define expressions as required for populating the new variables.
Using a Extract or SQL Join will generate SQL code and not SAS data step code - but this is something you shouldn't have to care about when using DIS.
Hi Patrik,
Thank you so much for your response.
I did see SQL was generated when I use extract.
I posted the question is because I couldn't generate SAS code instead of SQL.
Since SAS document says SAS data step need less resources than SAS SQL. I have been wondering how I can generate SAS code?
Now I got another confirmation that DI doesn't do that. Thanks!
DIS might very well generate SAS Data Step code, e.g. the Lookup Transformation uses (data step) hash objects or in the Loader Transformation you can even choose between "Modify" (=data step) and SQL.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.