April 2012 Quick Tips


Tip#1: Setting Print Options in Enterprise Guide

Tip #2: Calculating the Next Sequential Number and Storing it for Later Use

Tip #1:

Setting Print Options in Enterprise Guide

A feature of SAS Enterprise Guide is the ability to set up options one time and have them in effect for all the processes in your project.


Tools-> Options->Results: Results General:

Here we set the default Reporting Results to be in HTML format 



And under the HTML options set the style to BarrettsBlue




However, if you want to change these options for a particular task, you can do that as well as demonstrated in the List task below.


‘Modify’ the Task-> Properties->Edit->Results




Tip #2 

Calculating the Next Sequential Number and Storing it for Later Use

In the age of databases, it frequently happens that our tables/SAS datasets contain sequential numeric codes to uniquely identify a row/observation. If your program requires you to determine the next available sequential number in order to generate the value for a row that you want to insert into your table, here is a quick idea.

Determine the current highest value, add 1 to it and store the value in a macro variable using Proc SQL:

Proc SQL;

   Select max(compcode)+1

   Into: Mnext_compcode

   From Marketl.Company;



Then use the value when you insert the row into your table using Proc SQL again:

Proc SQL;

  Insert into Marketl.Company


  Compcode   =  &Mnext_compcode.,






To verify the row you added, print out the last 10 observations of your dataset using Proc PRINT:

%let Mnext_compcode_10=%eval(&Mnext_compcode. - 10);


Proc print data=Marketl.Company ;

Title 'Last 10 Observations on the Company Database';

   Where compcode between

        &Mnext_compcode_10.  and &Mnext_compcode.;