Don't Be a SAS® Dinosaur: Modernize Your SAS Programs
by Warren Repole

Details for the RawData data sources


Download the program that creates the RawData data sources [The complete program is shown below.]

Download the hier.dat Raw Data File

Download the emdash.dat Raw Data File

Download the datestyles.dat Raw Data File


Program Code

  /* Create hierarchical text file version of SASHELP.CITIDAY */
data _null_;
   file "c:\temp\dinosaur\hier.dat";
   set sashelp.citiday;
   where date between "01oct1988"d and "30apr1989"d;
   by date groupformat;
   format date monyy7.;
   if first.Date then put date year4. +1 date monname. -L ;
   if DCP07 ne . then put @2 date date9. +1 DCP07 8.2;
run;

  /* Create negative values from SASHELP.CITIDAY */
data DowJonesDiff;
  set sashelp.citiday(keep=Date SNYDJCM);
  where SNYDJCM is not missing;
  Difference=snydjcm-lag(snydjcm);
  ActualDifference=Difference;
run;
  /* Create text file with invalid characters from SASHELP.CITIDAY */
data _null_;
   file "c:\temp\dinosaur\emdash.dat";
   set DowJonesDiff(obs=10);
   string=put(Difference,best12.);
   if Difference lt 0 then string=translate(string,"97"x,"-");
   put SNYDJCM string;
run;

  /* Create text file with different date formats from SASHELP.CITIDAY */
data _null_;
   file "c:\temp\dinosaur\datestyles.dat";
   set sashelp.citiday;
   where year(date)=1989 and day(date) in (1,31);
   array formats {3} $ 12 _temporary_ ("yymmdd10.","mmddyy10.","date9.");
   DateString=putn(Date,formats{mod(_n_,3)+1});
   put DateString $10.;
run;

Partial Listing of Raw Data (hier.dat)

1988 October  
1988 November 
1988 December 
1989 January  
1989 February 
 24FEB1989     9.78
 27FEB1989     9.77
 28FEB1989     9.72
1989 March    
 01MAR1989     9.71
 02MAR1989     9.71
 03MAR1989     9.70
 06MAR1989     9.66
 07MAR1989     9.64
 08MAR1989     9.71
 09MAR1989     9.77
 10MAR1989     9.80
 13MAR1989     9.76
 14MAR1989     9.75
 15MAR1989     9.75
 16MAR1989     9.85
 17MAR1989     9.93
 20MAR1989     9.89
 21MAR1989     9.86
 22MAR1989     9.83

Partial Listing of Raw Data (EMdash.dat)

740.19999981 .
747.37999916 7.1799993515
750.39999962 3.0200004578
757.03999996 6.6400003433
711.35999966 -45.68000031
721.91999912 10.559999466
715.19999981 -6.719999313
713.5899992 -1.61000061
708.34999943 -5.239999771
721.80999947 13.460000038

Partial Listing of Raw Data (datestyles.dat)

01/31/1989
01FEB1989 
1989-03-01
03/31/1989
01MAY1989 
1989-05-31
06/01/1989
31JUL1989 
1989-08-01
08/31/1989
01SEP1989 
1989-10-31
11/01/1989
01DEC1989 


SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries.
® indicates USA registration.