How to find SAS version from SAS Enterprise Guide? - sas

In my previous work place where I had access to base SAS (running SAS interactively on the server directly), I could find out the current SAS version easily (from the SAS log) by issuing the code proc setinit; run;
In my new work place there is no base SAS - only Enterprise Guide. I try running the same code but the SAS version does not appear in the SAS log.
I would like to easily find out the SAS version running on the server from Enterprise Guide. Is this possible or not? If so, how?

The values you're looking for are stored in automatic macro variables in your system. The code below retrieves the macro variables and prints them to the log for your information.
%put ** my information;
%put short version: &sysver;
%put version: &sysvlong4;
%put site #: &syssite;
%put cpu: &sysscp &sysscpl;
EDIT: Update answer
You can use PROC PRODUCT_STATUS which is great, since it will print the relevant information to the log.
proc product_status;run;

There are some other options available rather than using the global macro variables (&sysver and &sysvlong4), if you prefer point-click options.
First, under Help -> About SAS Enterprise Guide, if you select 'Configuration Details' you can see your SAS system version.
Second, if you select the server in the Servers tree (in the window on the bottom left), and right click->Properties, you will see the SAS version/etc. information.
Third, if you continue in that and select "View Initialization Log", it will show you the initialization log (the bit SAS shows when you start a session in the log). This includes the version number and some other useful information.

Just run the following code and all available information will be printed automatically.
proc setinit;
run;

You can also use
%put _all_;
that will display all macro variables available in your session.

proc setinit;
run;
You can run this set of code and check the results. It will tell you the version you are using.

%put &_clientversion; gives you version.

proc setinit;
run;
Or under the help tab in the top left of the enterprise guide.

Related

SAS studio - formatting

I am attempting to format variables in SAS studio which have been truncated due to the name being longer than 32 characters, when I attempt to format the variables in SAS studio it gives the warning 'this variable in uninitialized'. when I run the same code in SAS EG against the same excel document imported, the code works fine and formats the variable. Why would the same code in SAS studio not work?
code:
data test;
set test1;
format 'variable'n best12.;
run;
Compare the value of option VALIDVARNAME in EG vs Studio. Set it in studio to the same as EG.
Two common ways to view the current setting of an option. Proc OPTIONS or function GetOption
proc options option=validvarname;
run;
%put %sysfunc(getoption(validvarname));
The code won’t be the same because you’re using two different applications with different default settings most likely. As someone else indicated, it’s likely the validvarname option that’s the issue. I would recommend setting it to V7 which avoids these issues. With this setting, SAS converts them to valid variable names by default and you can avoid the rename step entirely.
Supposedly the 32 char limit will be lifted in SAS 9.5. No release date has been announced, SAS 9.4 M5 was recently released so I’m not expecting it super soon.

SAS : ODS and code highlighting

When using R markdown for making statistical reports, I have the ability to echo the R code in my output document. I'm learning SAS and I was wondering if it was possible to highlight or echo the SAS code in my final ODS report ? I'm using a dirty hack right know to display the code in my document, which is using "ods text = ", but it seems quite redundant. Plus it doesn't add syntax highlighting.
That feature does not exist in the SAS language right now, but it has been mentioned in several talks by Amy Peters, principal product manager of the SAS programing environments, as a planned feature for a near-future SAS release (with no specific date yet, but hopefully in the next 2 years). It would likely be implemented in a similar fashion to Jupyter Notebooks, in that you write your code and get your output inline.
That said, SAS does support Jupyter Notebooks, which is the best current (third party) solution. Contact your SAS administrator for more information.
I have an idea here, I'm the type of guy who dosent take no for answer and find a way to fiddle and get it done... but i think this is abit far fetch... you can try still I think it will work with mostly evrything but may have a hard time to play with quotes when you have multiple semi colomns....
Check:
I started by creating a dumbass dataset :
data tata;
x=1;
run;
then we do the following:
%let code= select * from tata;
proc sql;
create table report as
&code.;
quit;
proc print data=report;
footnote "&code.";
run;
The rationale:
I think it you put your code in macrovariables and then execute those macro variables you would be able to print show the code after by printing the macrovariable following your text...
See the sample

DM command to open last dataset in rwork library

dm "vt &syslast";
The above command opens the last created dataset in work library.
How do I make it work for RWORK library?
dm "vt &syslast." will open the most recently created table, regardless of what location it is stored in. So if the most recently created table is in RWORK, that should not be a problem.
What might be a problem is the definition of &syslast, however. If you are doing something like:
rsubmit;
data class;
set sashelp.class;
run;
endrsubmit;
dm "vt &syslast.";
That won't work - &syslast is defined on the remote computer, not on your local computer. You either need to use %sysrput to put the macro variable onto your local machine, or know the name of the dataset you want to open.
rsubmit;
data class;
set sashelp.class;
run;
%sysrput rdata=&syslast;
endrsubmit;
dm "vt &rdata";
Or something along those lines. I think you'd probably have to translate the libname - &rdata would contain WORK.CLASS here, and you'd have to add an R - but it might be as simple as:
dm "vt R&rdata";
since you just want to prepend an R.
You could also directly specify the table, dm "vt rwork.tablename", and open any arbitrary table.
DM commands only work in SAS Display Manager environment (often called "Base SAS") and will not work in Enterprise Guide or SAS Studio. Both EG and Studio automatically open tables created during the current submission, by default, though the option to do so can be turned off.

Error W/ PROC GEOCODE

Hopefully someone out there will have run into this before. I'm trying to use the street level geocoding capability of SAS' PROC GEOCODE, but I keep getting a cryptic error. I couldn't find anything on the net about it (although to be fair I only spent a half hour looking).
First, I'm using SAS Enterprise Guide (I've tried on both v4.2 and v4.3), although I still prefer to program as I find the point and click interface quite limiting. Maybe this right here is my problem?
Anyway I first get the lookup data sets from http://support.sas.com/rnd/datavisualization/mapsonline/html/geocode.html and follow the instructions in the readme. I also use the pre-written SAS program to import the CSV files. My input dataset contains just 4 variables: street address, city, state, and zip. I then run the following code:
libname josh 'C:\Users\Josh\Desktop\Geocode\SAS files';
proc geocode
method=street
data=SASUSER.Home_Policy_Address_Detail
lookupstreet=josh.USM
out=test;
run;
However I get this error:
ERROR: Variable NAMENC not found in JOSH.USM data set.
Nowhere in the readme or the import program is a variable named "NAMENC" ever mentioned. This is what has me stumped. Is it something wrong with the simple PROC GEOCODE program I wrote? Is it due to me using SAS EG (although I've yet to run into a base SAS procedure that hasn't worked on EG)? Or something else?
Any help/guidance would be much appreciated. Thanks in advance!
Check your SAS version. You can use the 'Help' menu in DMS mode or submit this statement:
%put &sysvlong;
It looks like you are using SAS 9.3 but your lookup data JOSH.USM is the lookup data formatted for SAS 9.4.
PROC GEOCODE street lookup data comes in two slightly different formats, one for SAS 9.3 and another for 9.4. When you download the nationwide lookup data from the SAS MapsOnline geocoding page, make sure to download the version appropriate for your SAS release.

Creating a matrix using proc iml in sas eg

When you submit a PROC IML in SAS EG it appends a QUIT statement to the program, this quit statement terminates the procedure and deletes all previously computed matrices.
Does anyone know a workaround?
You should use SAS/IML Studio. That is the IML version of enterprise guide; it should allow you to connect to a SAS Workspace server, if you're not running in local.
See Getting Started with the SAS/IML Language by Rick Wicklin (2013 SGF paper) for more details.