BookmarkSubscribeRSS Feed
Zeus_Olympus
Fluorite | Level 6

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

 

Zeus_Olympus_0-1656329161469.png

Zeus_Olympus_0-1656329651051.png

 

2 REPLIES 2
ErikLund_Jensen
Rhodochrosite | Level 12

@Zeus_Olympus 

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.

 

 

LinusH
Tourmaline | Level 20

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.

Data never sleeps

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 515 views
  • 0 likes
  • 3 in conversation