Proc Report Help

  • Follow


I'm new to the proc report command in SAS. I have been looking at the
Little SAS book and a few pdf I found online on how to write this
code. But I can't seem to get it to work. So I am hoping someone can
give me advice on how to write this code.

BAsically I want to create a table and ODS it into an excel file. The
format I want can be found at:
http://picasaweb.google.com/lh/sredir?uname=Tan.P.Pham&target=PHOTO&id=5514666771465728258&aid=5406033796425849297&authkey=Gv1sRgCIvW6K-o2Z_uvgE&feat=email

So Basically, I have 3 variables;

ID: Character variable (so like "doctor" "dentist")
Variable 1: numerical score for 2008 that the ID scored
Variable 2: numerical score for 2009 that the ID scored

so basically the way I want it is have the ID nested into 2008 and
2009.

So looking at the table in excel, I would like Colmn A and B for the
first row to be "Doctor" (aka ID 1)
and then on row 2, colmn A would be the score for 2008 that the doctor
scored and then colmn B would be the score for 2009 that the doctor
score.. and then C and D would be for dentist (ID 2)  for row 1 and
the same for row 2. How does one generate this report?

I have about 60 IDs and 14 variables for each of the 2 years. So I'm
trying to figure out a way to do this without just copying and pasting
it by hand, which leaves room for human error.

Anyone have any suggestions?

Thanks
Tan
0
Reply Tan 9/8/2010 10:11:04 PM

On Sep 8, 3:11=A0pm, Tan <tan.p.p...@gmail.com> wrote:
> I'm new to the proc report command in SAS. I have been looking at the
> Little SAS book and a few pdf I found online on how to write this
> code. But I can't seem to get it to work. So I am hoping someone can
> give me advice on how to write this code.
>
> BAsically I want to create a table and ODS it into an excel file. The
> format I want can be found at:http://picasaweb.google.com/lh/sredir?uname=
=3DTan.P.Pham&target=3DPHOTO&i...
>
> So Basically, I have 3 variables;
>
> ID: Character variable (so like "doctor" "dentist")
> Variable 1: numerical score for 2008 that the ID scored
> Variable 2: numerical score for 2009 that the ID scored
>
> so basically the way I want it is have the ID nested into 2008 and
> 2009.
>
> So looking at the table in excel, I would like Colmn A and B for the
> first row to be "Doctor" (aka ID 1)
> and then on row 2, colmn A would be the score for 2008 that the doctor
> scored and then colmn B would be the score for 2009 that the doctor
> score.. and then C and D would be for dentist (ID 2) =A0for row 1 and
> the same for row 2. How does one generate this report?
>
> I have about 60 IDs and 14 variables for each of the 2 years. So I'm
> trying to figure out a way to do this without just copying and pasting
> it by hand, which leaves room for human error.
>
> Anyone have any suggestions?
>
> Thanks
> Tan

Proc tabulate + ODS tagset.excelXP should work:

data xx;
input id $ sc08 sc09;
cards;
doc 23 34
den 45 56
;

ods tagsets.excelxp file=3D"c:\temp\junk.xls";

proc tabulate data=3Dxx;
class id;
var sc08 sc09;
table id=3D''*(sc08=3D'Score 08' sc09=3D'Score 09')*sum=3D'';
run;

ods _all_ close;

HTH

Ya
0
Reply Ya 9/8/2010 10:54:31 PM


Seems simple enough , if I understand what you want.
Not sure how valuable that layout is going to be for you as it will
have only one row of actual data.

data x;
  do id=3D1 to 10;
    y2008=3D100*ranuni(0);
    y2009=3D110*ranuni(0);
    output;
  end;
run;

proc report nofs headline missing;
  column id,(y2008 y2009);
  define id / across;
run;


On Sep 8, 6:11=A0pm, Tan <tan.p.p...@gmail.com> wrote:
> I'm new to the proc report command in SAS. I have been looking at the
> Little SAS book and a few pdf I found online on how to write this
> code. But I can't seem to get it to work. So I am hoping someone can
> give me advice on how to write this code.
>
> BAsically I want to create a table and ODS it into an excel file. The
> format I want can be found at:http://picasaweb.google.com/lh/sredir?uname=
=3DTan.P.Pham&target=3DPHOTO&i...
>
> So Basically, I have 3 variables;
>
> ID: Character variable (so like "doctor" "dentist")
> Variable 1: numerical score for 2008 that the ID scored
> Variable 2: numerical score for 2009 that the ID scored
>
> so basically the way I want it is have the ID nested into 2008 and
> 2009.
>
> So looking at the table in excel, I would like Colmn A and B for the
> first row to be "Doctor" (aka ID 1)
> and then on row 2, colmn A would be the score for 2008 that the doctor
> scored and then colmn B would be the score for 2009 that the doctor
> score.. and then C and D would be for dentist (ID 2) =A0for row 1 and
> the same for row 2. How does one generate this report?
>
> I have about 60 IDs and 14 variables for each of the 2 years. So I'm
> trying to figure out a way to do this without just copying and pasting
> it by hand, which leaves room for human error.
>
> Anyone have any suggestions?
>
> Thanks
> Tan

0
Reply Tom 9/9/2010 4:00:25 AM

2 Replies
361 Views

(page loaded in 0.039 seconds)

Similiar Articles:













7/25/2012 12:40:49 PM


Reply: