Online File
Rick Aster: Professional SAS Programming Secrets: Contents
Tentative version | Final | Data
This version of the program contains errors that are corrected in an exercise in the book.
* Professional SAS Programming Secrets Program 4b (tentative) Planets compared to dwarf planets *; filename planets "planet1.csv"; filename dwarf "dwarfplanet1.csv"; data work.planet; length planet $ 16 sequence mass radius 8; infile planets dsd; input planet sequence mass radius; run; data work.dwarf; length planet $ 16 sequence mass radius 8; infile dwarf dsd; input planet sequence mass radius; run; * Combine data. * data work.orbital; length bodytype $ 12; set work.planet (in=big) work.dwarf (in=small); if big then body = 'Planet'; else body = 'Dwarf Planet'; log_radius = log10(radius) + 3; log_mass = log10(mass) + 21; run; * Summary statistics. *; title1 'Planets and Dwarf Planets'; proc summary data=work.orbital nway print n mean min max; class bodytype; var mass radius; label mass='Mass (10^21 kg)' radius='Radius (km)'; run; * Plots. *; options nocenter; proc plot data=work.orbital; plot mass*radius=bodytype; run; plot log_mass*log_radius='o' $ planet; run; quit;
The final, corrected version of the program.
* Professional SAS Programming Secrets Program 4b Planets compared to dwarf planets *; filename planets "planet1.csv"; filename dwarf "dwarfplanet1.csv"; data work.planet; length planet $ 16 sequence mass radius 8; infile planets dsd; input planet sequence mass radius; run; data work.dwarf; length planet $ 16 sequence mass radius 8; infile dwarf dsd; input planet sequence mass radius; run; * Combine data. *; data work.orbital; length bodytype $ 12; set work.planet (in=big) work.dwarf (in=small); if big then bodytype = 'Planet'; else bodytype = 'Dwarf Planet'; log_radius = log10(radius) + 3; log_mass = log10(mass) + 21; run; * Summary statistics. *; title1 'Planets and Dwarf Planets'; proc summary data=work.orbital nway print n mean min max; class bodytype; var mass radius; label mass='Mass (10^21 kg)' radius='Radius (km)'; run; * Plots. *; options nocenter; proc plot data=work.orbital; plot mass*radius=bodytype; run; plot log_mass*log_radius='o' $ planet; run; quit;
These initial steps from the program create SAS data sets that are used in other programs throughout the book.
* Professional SAS Programming Secrets Program 4b-data steps Planets compared to dwarf planets *; filename planets "planet1.csv"; filename dwarf "dwarfplanet1.csv"; data work.planet; length planet $ 16 sequence mass radius 8; infile planets dsd; input planet sequence mass radius; run; data work.dwarf; length planet $ 16 sequence mass radius 8; infile dwarf dsd; input planet sequence mass radius; run; * Combine data. *; data work.orbital; length bodytype $ 12; set work.planet (in=big) work.dwarf (in=small); if big then bodytype = 'Planet'; else bodytype = 'Dwarf Planet'; log_radius = log10(radius) + 3; log_mass = log10(mass) + 21; run;