BookmarkSubscribeRSS Feed
ASASProgrammer
Calcite | Level 5

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!

5 REPLIES 5
LinusH
Tourmaline | Level 20

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. 

Data never sleeps
ASASProgrammer
Calcite | Level 5

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.

Patrick
Opal | Level 21

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.

ASASProgrammer
Calcite | Level 5

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!

Patrick
Opal | Level 21

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 5 replies
  • 1511 views
  • 0 likes
  • 3 in conversation