BookmarkSubscribeRSS Feed
varatt90
Obsidian | Level 7

Hi, 

 

I'm using SAS studio. 

 

Using the original dataset, I've created a new dataset with no missing variables. Instead of running the code each time to create that new dataset, is there a way I can save the new dataset onto the server? So the new dataset would be my new default. 

 

Any help would be appreciated. 

 

Thanks!

 

 

6 REPLIES 6
Reeza
Super User

What I do, import my raw data, call it raw. 

Then do a bunch of cleaning step. Save it to the server with a new name, ie 'proj4.data4analysis' I'm not that creative. 

 

Then all the following steps are built off the data4analysis dataset. 

 

I do not replace the raw import data but do not save intermediary steps between the raw and data4analysis typically either. That could be reproduced by running the program if someone wants. 

 

 

varatt90
Obsidian | Level 7

Thanks so much! What code do you use to save it as a new file?

 

 

Reeza
Super User
library proj4 '/home/fkhurshed/Demo1/Project4/data';

*import file;
proc import out=raw..... run;

data clean1;
set raw;
...
run;

data clean4;
set clean3;
....
run;

data proj4.data4analysis;
set clean4;
run;

See the last step. 

You create the library where you want to save the project work first. 

That's usually how my process would work to some degree. To be honest, I'd actually usually separate out the import step as well into a separate program but that's when you get to really streamlining a process. I set it up as minimum 4 programs:

  • data import
  • data cleaning (creates data for analysis)
  • analysis
  • reporting/results creation

Reason being, that sometimes data sources change over time. For example when I start a proof of concept it may be CSV files I work with and then when moving later on, it becomes a DB table that I'm working with instead so then I can just change it easily in a single program. 

 

varatt90
Obsidian | Level 7

Thank you for sharing your code.

 

I see what you did there. Is there way to save the dataset proj4.data4analysis without actually running proc import of the old data again and datasets clean 1 to 4? 

Reeza
Super User
Assuming it's in work or somewhere you just run the last step. Then the remainder of your code must reference that saved data set, not the original imported data.
varatt90
Obsidian | Level 7

Got it! Thank you for your help! 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1422 views
  • 2 likes
  • 2 in conversation