Starting with PC-SAS and have been giving a SAS dataset ccc.sas7bdat.
On that dataset is a variable that I have modified, I have made the new variable and dropped the previous variable.
How do I then get the new SAS dataset written back to the LIBNAME:
My current code:
libname wombat 'd:\rawdata';
data wombat.sra1 (drop = ssan); set one;
proc contents data=wombat.sra1;
run;
data _null_; set wombat.sra1; file 'd:\rawdata\ddd.sas7bdat';
run;
Thank you -- as a mainframe programmer of over 25 years, it has been too long understanding libraries and how to properly write out a file -- your code helped me realize that I needed to just use the libname and membernames of the dataset I was creating to get the job done. I got it to work so I thank you ! Scott S
Your code should be something like below. Please read the comments.
*Create library to get/put data;
libname wombat 'd:\rawdata';
*bring dataset into work library from wombat library;
data one (drop = ssan); /*new dataset to be created*/
set wombat.sra1; /*Dataset being read from*/
new_var=ssan*2; /*create new var*/
run;
*examine contents of dataset one;
proc contents data=one;
run;
*write back to library;
data wombat.sra2; /*new dataset, back in wombat library*/
set one; /*dataset being read from*/
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.