BookmarkSubscribeRSS Feed
sridhar78
Calcite | Level 5

I was recently working on a small project on car brands, where I had to code the brands.

I used the Query builder and did the following :-

1) recode a column (computing new variable and existing variable) &

2) Computing a new variable using existing variable by doing some math calculations (using adv. Expression editor)

After completing my tasks and saving the projects I saw a warning saying that my Query file is a temporary file and will be lost.

When I came back and opened the project I found only my data file open with recoding changes (as in (1) above).

But the query and calculations were lost.

How do I save the query as well as the result of the query? I want to save this on SAS library as well as on my local disk. How to do this?

3 REPLIES 3
Patrick
Opal | Level 21

The query as such (the SAS code) is stored within your EG project. The result of the query (the data) will get written to the SAS library you define in the moment when you execute the SAS code. The default in the query builder is WORK. WORK is session specific and gets cleaned up when you disconnect EG from the Server.

You need to direct your output data set to a permanent SAS library  (so not WORK). The "Change..." button allows you to select another SAS library.

Capture.PNG

You can also first define your own SAS library and then select this library as output. The path name in the library statement is the physical location where the SAS data set will get stored.

Please note that your SAS code is run on the SAS workspace server. If this server is not "local" the it is a remote server and the file system where you write your data to must be accessible from the server. So it can't be your local c-drive. It normally can be some shared drive which is accessible from both the Server and your Workstation.

Else: Once you've created the SAS data set sent it to an Excel file (right click the table in EG and then select "send to").

sridhar78
Calcite | Level 5

Hi Patrick,

Thank you so much for explaining in detail about the library in SAS. Your suggestions were highly valuable. Now I understand that all important work needs to go to user created permanent libraries (not WORK). Thanks.

I have one question.

I was able to store the output file in my own library. But it was in a table format (which is not good).

So I ran the analysis again and created a Custom Report and it was saved on server. I was able to export the reports and download to my system. Is there a way I can save the custom reports in my library ? Though its not appearing in my library Im still able to access it whenever I log-on to SAS server.

Patrick
Opal | Level 21

A bit simplified: SAS operates on orthogonal tables, so data organised in columns and rows. In the SAS terminology a column is called "variable" and a row is called "observation".

In order for SAS to utilise data from other sources (eg: "raw" data in a .csv file) the data needs first to be imported into SAS (EG wizard: File/Import).

Once the data is in SAS tables you massage it and in the end you either write it to a permanent table or you create some kind of report.

A library definition is used to access tables and views (so: data in rows and columns). A report is an external file (or files) of various formats (html, .docx, .pdf,...).

Using EG a report gets added to the EG project and does not reside on the server. You can test this by closing your Server connection (disconnect) in EG. Even if the connection to the server is closed you still can open your report in EG.

In EG under Tools/Options/Results you can extend the ODS settings (ODS: Output Delivery System) and I would assume you could add there some code so that report output gets written to some network drive. This drive could be the same than where you're writing your permanent SAS tables to (also: I would keep it in separate folders).

I'm only using the EG report wizards on an adhoc basis. I suggest you start a new thread in the EG Section to get some insights from "regulars" on how to best manage your projects and reports using EG.  https://communities.sas.com/community/support-communities/sas_enterprise_guide

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1278 views
  • 1 like
  • 2 in conversation