BookmarkSubscribeRSS Feed
VVDR
Obsidian | Level 7

Hi All,

I have a SAS Data set with BATCH_NO, SNAPST_DT and TABLE_NM variables and some values.

I have a .sas file. Upon executing this .sas file it creates some values to the environment variables. Now, I want to insert those values into the SAS dataset. Please suggest me how can I do that. 

I found a way of updating the SAS data set update by using the below code:

proc sql;
  update Lib1.A_batch_table_met_one
    set No_Of_Records=input(sysget('NEW_TABLE_ROW_VAL'),best.)
    where Batch_No=input(sysget('BATCH_NO'),best.)
    AND Table_Name=sysget('TABLE_NM')

quit;
1 REPLY 1
Jagadishkatam
Amethyst | Level 16

This is an untested code, you should try to join the two tables lib1.a_batch_table_met_one and the one table have with new variables and join them on BATCH_NO and TABLE_NM variables.

 

proc sql;
create table want as select a.*,b.var1,b.var2 from lib1.a_batch_table_met_one as a left join have as b on a.batch_no=b.batch_no and a.table_nm=b.table_nm;
quit;
Thanks,
Jag

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 Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 373 views
  • 0 likes
  • 2 in conversation