* Sample SAS Program "sasprocs.sas" ; /* USING SAS PROCEDURES (See note 1 below.) */ /* PRINTing a data set */ /* Processing selected VARiables */ /* Processing selected OBServations */ /* Processing selected obs based on a condition */ /* Processing selected VARiables and selected observations based on a condition */ /* Processing data in groups */ /* GLOBAL STATEMENTS */ libname sas3 '[drive]:\[your_folder\]'; options ls=75 nodate pagesize=30; /* PRINTING A DATA SET */ proc print data=sas3.tourrev2; run; /* PROCESSING SELECTED VARIABLES */ proc print data=sas3.tourrev2; var country landcost vendor; run; /* RE-ORDERING VARIABLES */ proc print data=sas3.tourrev2; var vendor country landcost; run; /* PROCESSING SELECTED OBSERVATIONS */ proc print data=sas3.tourrev2 (obs=3); run; proc print data=sas3.tourrev2 (firstobs=4); run; proc print data=sas3.tourrev2 (firstobs=4 obs=6); run; /* PROCESSING SELECTED OBSERVATIONS */ /* BASED ON A CONDITION. */ /* (See notes 2-4 below.) */ proc print data=sas3.tourrev2; where country='France' or country='Spain'; run; /* PROCESSING SELECTED VARIABLES */ /* AND SELECTED OBSERVATIONS */ proc print data=sas3.tourrev2; var country landcost; where country='France' or country='Spain'; run; /* PROCESSING DATA IN GROUPS */ proc sort data=sas3.tourrev2 out=temp; by vendor; run; proc print data=temp; var vendor country landcost bookings; run; /*-----------------------------------------------------*/ /* NOTES: */ /* 1. The Proc Print procedure is used for most of */ /* these examples. However, the statements and */ /* statement options shown work with many other */ /* SAS procedures as well. */ /* 2. "WHERE" Statements CANNOT be used in */ /* combination with the "OBS=" option in a */ /* Data or Proc Step Option. FIRSTOBS must be 1. */ /* 3. "WHERE" Statements cannot be used in */ /* combination with IF/THEN Statements. */ /* 4. The Subsetting IF Statement cannot be */ /* used in a Proc Step. */ /*-----------------------------------------------------*/