Help using Base SAS procedures

Serial Number for proc print

Reply
Occasional Contributor
Posts: 14

Serial Number for proc print

Hi All,

   Is there any option in proc print to print the serial number instead of observation number..?

for example : proc print with obs option is resulting in below output..

          Obs    Name       Sex    Age    Height    Weight

             1    Alfred      M      14     69.0      112.5

             5    Henry       M      14     63.5      102.5

             6    James       M      12     57.3       83.0

             9    Jeffrey     M      13     62.5       84.0

but I want it to print

               Obs    Name       Sex    Age    Height    Weight

             1    Alfred      M      14     69.0      112.5

             2   Henry       M      14     63.5      102.5

             3   James       M      12     57.3       83.0

             4    Jeffrey     M      13     62.5       84.0

Thanks in advance..

Regular Contributor
Posts: 171

Serial Number for proc print

Will this work?

data class /view=class;

      set sashelp.class;

run;

proc print data=class;

      where name in ('Alfred' 'Henry' 'James' 'Jeffrey');

run;

Frequent Contributor
Posts: 138

Serial Number for proc print

Can create a Variable sno=_n_ and then print the report with noobs option.

Super User
Posts: 9,671

Serial Number for proc print

As far as I know there is not such a option. You need to make a variable to display this information.

Ksharp

Ask a Question
Discussion stats
  • 3 replies
  • 188 views
  • 0 likes
  • 4 in conversation