Tag Archive: SAS BASE

Jul 18

Zero filling in Report objects

In clinical reporting, we may require to have all the possible combination displayed in report objects among the specified variable in a datasets. There are many ways to accomplish this task and here are couple techniques to achieve the same. data dummy;     subjid=1; trt=1; resp=’N’; ; agegrp=’>=65′; output;     subjid=2; trt=2; resp=’Y’; agegrp=’<65 ‘; …

Continue reading »

Jan 18

Median function in SAS Proc SQL

In version 9, SAS introduced MEDIAN function in Proc SQL with limitation that it can be used only to return median value of current row(observation). proc sql; Create table  meddata  as select usubjid, median(var1, var2, var3, var4 ) as medvar from vsdata; quit;

Jan 16

Swap the Names of Two SAS Files

Use the EXCHANGE statement in PROC  DATASETS to swap the names of two SAS files. This example changes the name of WORK.PLACE to WORK.ADDRESS and changes the name of WORK.ADDRESS to WORK.PLACE: proc datasets library=work nolist;    exchange address=place;quit; Note: PROC DATASETS statement writes a member list in the log.  NOLIST suppresses this.

Jan 16

PDF Encryption in SAS 9.2

ODS (Output Delivery System) statements provide greater flexibility in generating, storing and reproducing SAS procedure and DATA step output. ODS system in SAS 9.2 is very powerful and ODS PDF statement can be used to generate outputs in PDF format. If the files are not encrypted, anyone can view and edit these files using acrobat. …

Continue reading »

Jan 15

Macro invocation using CALL EXECUTE

CALL EXECUTE is a powerful tool which provide optimal solutions for various programming task. The CALL EXECUTE routine allows us to build statements that are stacked for later execution. CALL EXECUTE statements are resolved first and then moved to the input stack while iterating the data step. CALL EXECUTE resolves its argument and executes the …

Continue reading »