Hi dear all,
I import CARS_NEW into SAS DI.
I need a couple of variables to be added to the output table.
I add the below code to the "User-Written Transformation".
====
data &_output;
retain Ex_Date dsname;
set &_input indsname=source;
dsname=scan(source,2,'.');
format Ex_Date yymmddn8.;
Ex_Date=mdy(6,20,2020);
run;
====
The transformation runs without errors but the new variables are not getting added to the output table.
I would appreciate any suggestions.
Thank you
Hi again.
The columns in SAS metadata (what you see in DI Studio) has no direct connection to the actual columns in the physical data set. When you open a table in DI Studio, if fails if any metadata column is not present in the physical data set, but if all columns exist, the values are shown. But there might be opher columns in the physical data set.
I suppose you have mapped the columns in the User Written transformation, added the code and run the job. So you see the input vaiables, but not the new variables. After first run of a user written transformation, ALWAYS right click on the output table and select "update metadata". Then you should have the new variables as well.
One downside of using user written is the manual management of metdata, like @ErikLund_Jensen points out.
For your use case, I see no point of using user written, an Extract could suffice (by using &_input instead of indsname in the mapping). By doing so, you get the metadata updated OOTB.
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.