Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening SAS datasets for viewing from within a .sas program

Tags:

sas

Is there a way to open a SAS dataset for viewing (i.e., in the "ViewTable" window) from within a .sas file?

like image 737
Lauren Samuels Avatar asked Feb 17 '09 14:02

Lauren Samuels


People also ask

How do I access data sets in SAS?

To access your data file(s), select File → Open → Data and then select SAS Servers. Next, select the library that you defined in your LIBNAME statement. 12. You can now access your SAS data set(s) to use in your SAS software application.

Can you open a SAS file without SAS?

No SAS software or ODBC configurations are required. The addin directly reads the SAS file and then inserts the data and metadata into your worksheet.

How do I import SAS dataset into SAS EG?

1) Open SAS Enterprise Guide, highlight File on the Menu bar, and select Import Data. 2) The Open Dialog box will open. Navigate to the location of your file, highlight it, and click the Open button. 3) Now the Import Data Dialog box will open.


2 Answers

I think this will do what you want:

dm log "vt sashelp.air";

Just change the "sashelp.air" part to your lib.table combo.

like image 79
dw.mackie Avatar answered Oct 19 '22 14:10

dw.mackie


dw.mackie's answer is right on the money. That works great when submitted from the SAS editor window.

But I just want to caution you to be careful if you attempt it in batch mode (that is, having SAS run a .sas program directly from command-line using the -sysin option). It will indeed attempt to pop open the interactive SAS window environment upon execution.

But, if your batch code also attempts to build some graphs/charts, you'll be required to use the -noterminal option. And the -noterminal option isn't compatible with the dm command. You'd spot it right away in the log, but I just wanted to give you a heads-up.

like image 44
robmandu Avatar answered Oct 19 '22 12:10

robmandu