Hi,
I am trying to use COMPLTEROWS option to show all possible subjects on my
report. the across variable is gender with two levels. the variable share
the same coumn with the GENDER is character type. it is defined
as "DISPLAY" in define statment. the problem i am having is I get too many
unwanted rows. Based on SAS DOC :
"displays all possible combinations of the values of the group variables,
even if one or more of the combinations do not occur in the input data
set. Consequently, the row headings are the same for all logical pages of
the report within a single BY group."
I shouldn't get that many rows(each subjects have 37 rows). Can someone
explain why I am having 37 rows for each subject.
Thank you.
The code below will demonstrate my problem. when you run through the code,
please check the sas dataset OUT to see # of the OBS per subject.
data class;
retain fmtname 'nmlst' type 'c';
set sashelp.class (keep=name) end=last;
start=name;
label=name;
output;
if last then do;
name='Yu';
start=name;
label=name;
output;
end;
run;
proc format cntlin=class;
run;
proc report data=sashelp.class nowd Completerows out=out;
column name sex,(weight height) dummy;
define name/group preloadfmt order=data format=$nmlst. ;
define sex/across;
define weight/display;
define height/display;
define dummy/computed;
run;
|
|
0
|
|
|
|
Reply
|
zhangyu05 (659)
|
8/16/2007 2:37:24 PM |
|
Hiya
I believe COMPLETEROWS will give you 1 column for each value of Height in
your input data. Likewise for Weight.
By changing your code to
data class;
retain dummy 0;
set sashelp.class (keep=name sex weight height) end=last;
output;
if last then do;
name='Yu';
output;
end;
run;
proc report data=class nowd out=out;
column name sex,(weight height) dummy;
define name/group order=data;
define sex/across;
define weight/display width=6;
define height/display width=6;
define dummy/sum noprint; /* Dont want this printed */
quit; /* Changed from RUN */
I achieved results that I think you want.
There is no need to specify preloadfmt or format on your NAME statement.
I only use preloadfmt for ACROSS variables.
I specified NOPRINT on the define statement, as I don't think you need
this listed.
You may need to create a format for GENDER.
Hope this helps.
Tom
On Thu, 16 Aug 2007 10:37:24 -0400, Yu Zhang <zhangyu05@GMAIL.COM> wrote:
>Hi,
>
>I am trying to use COMPLTEROWS option to show all possible subjects on my
>report. the across variable is gender with two levels. the variable share
>the same coumn with the GENDER is character type. it is defined
>as "DISPLAY" in define statment. the problem i am having is I get too many
>unwanted rows. Based on SAS DOC :
>
>"displays all possible combinations of the values of the group variables,
>even if one or more of the combinations do not occur in the input data
>set. Consequently, the row headings are the same for all logical pages of
>the report within a single BY group."
>
>I shouldn't get that many rows(each subjects have 37 rows). Can someone
>explain why I am having 37 rows for each subject.
>
>Thank you.
>
>
>The code below will demonstrate my problem. when you run through the code,
>please check the sas dataset OUT to see # of the OBS per subject.
>
>
>
>
>data class;
>retain fmtname 'nmlst' type 'c';
>set sashelp.class (keep=name) end=last;
>start=name;
>label=name;
>output;
>if last then do;
>name='Yu';
>start=name;
>label=name;
>output;
>end;
>run;
>
>
>proc format cntlin=class;
>run;
>
>proc report data=sashelp.class nowd Completerows out=out;
>column name sex,(weight height) dummy;
>define name/group preloadfmt order=data format=$nmlst. ;
>define sex/across;
>define weight/display;
>define height/display;
>define dummy/computed;
>run;
|
|
0
|
|
|
|
Reply
|
tom.hide1 (90)
|
8/17/2007 10:53:40 AM
|
|
Hi, Tom,
thank you for taking time looking at my problem and your suggestion. I
think I didn't make my question clear. and sorry I can provide the real
sample to list.
I have a serum test dataset with patno,sample_date,result, visit_day and
regimen. not evey subject in the study was drawn the blood sample. I need to
list all subjects in my report, even a subject doesn't has test result. the
regimen and visit_day will be defined as ACROSS varaible.
I knew I can make a full list of subjects and merge it with my test dataset
to get the desired output. However, I believe the completerows option can
let me have same output but with less coding.
My question is why Completerows gives out so many unwanted rows and how?
What this option does behind the scene?
The sample code can be used to generate the strange output dataset.
any explanations??
On 8/17/07, Tom Hide <tom.hide@dehiworld.com> wrote:
>
> Hiya
>
> I believe COMPLETEROWS will give you 1 column for each value of Height in
> your input data. Likewise for Weight.
>
> By changing your code to
>
> data class;
> retain dummy 0;
> set sashelp.class (keep=name sex weight height) end=last;
> output;
> if last then do;
> name='Yu';
> output;
> end;
> run;
>
> proc report data=class nowd out=out;
> column name sex,(weight height) dummy;
> define name/group order=data;
> define sex/across;
> define weight/display width=6;
> define height/display width=6;
> define dummy/sum noprint; /* Dont want this printed */
> quit; /* Changed from RUN */
>
>
> I achieved results that I think you want.
>
> There is no need to specify preloadfmt or format on your NAME statement.
> I only use preloadfmt for ACROSS variables.
> I specified NOPRINT on the define statement, as I don't think you need
> this listed.
>
> You may need to create a format for GENDER.
>
> Hope this helps.
>
> Tom
>
> On Thu, 16 Aug 2007 10:37:24 -0400, Yu Zhang <zhangyu05@GMAIL.COM> wrote:
>
> >Hi,
> >
> >I am trying to use COMPLTEROWS option to show all possible subjects on my
> >report. the across variable is gender with two levels. the variable share
> >the same coumn with the GENDER is character type. it is defined
> >as "DISPLAY" in define statment. the problem i am having is I get too
> many
> >unwanted rows. Based on SAS DOC :
> >
> >"displays all possible combinations of the values of the group variables,
> >even if one or more of the combinations do not occur in the input data
> >set. Consequently, the row headings are the same for all logical pages of
> >the report within a single BY group."
> >
> >I shouldn't get that many rows(each subjects have 37 rows). Can someone
> >explain why I am having 37 rows for each subject.
> >
> >Thank you.
> >
> >
> >The code below will demonstrate my problem. when you run through the
> code,
> >please check the sas dataset OUT to see # of the OBS per subject.
> >
> >
> >
> >
> >data class;
> >retain fmtname 'nmlst' type 'c';
> >set sashelp.class (keep=name) end=last;
> >start=name;
> >label=name;
> >output;
> >if last then do;
> >name='Yu';
> >start=name;
> >label=name;
> >output;
> >end;
> >run;
> >
> >
> >proc format cntlin=class;
> >run;
> >
> >proc report data=sashelp.class nowd Completerows out=out;
> >column name sex,(weight height) dummy;
> >define name/group preloadfmt order=data format=$nmlst. ;
> >define sex/across;
> >define weight/display;
> >define height/display;
> >define dummy/computed;
> >run;
>
|
|
0
|
|
|
|
Reply
|
zhangyu05 (659)
|
8/17/2007 2:05:07 PM
|
|
|
2 Replies
37 Views
(page loaded in 0.059 seconds)
Similiar Articles: PROC EXPORT excel formatting in SAS 9.2 on x64 - comp.soft-sys.sas ...... analyses/queries and then export these results ... traffic-light formatting from Proc Report; you'd have to use Excel ... I think it's very weird. And it's very easy to ... Regarding SAS Macro - comp.soft-sys.sas... and (c) and obtained that they have the same result. ... test.printb test.printc ; run; I know, a strange ... PROC REPORT / Highlighting not working ? :-( - comp.soft ... problem with mixed c and fortran code - comp.lang.fortran ...... c')\n",cp1,c1,cp2,c2); return 0; } Strange result ... of business would be to file a compiler bug report. ... FLAT 'DATA' _DATA ENDS EXTRN for_cpystr:PROC ... Adding simple database, excel export, and reports with D4 Pro ...It seems a bit strange. They're a ... read characters} Stream.Read(Result[1], LenStr); end; procedure ... Report Lite - comp.text.pdf Adding simple ... fcopy -size limit - comp.lang.tcl... asked-for case I think) then the result ... PROC COPY and compress option - comp.soft ... limitation - comp.unix.programmer... using fopen() in stdio.h? fopen() will report ... Math logic - comp.lang.asm.x86I am new to using division in my code. I am trying to ... Well, in that case we can do some really strange tricks ... include \masm32\include\masm32rt.inc ..code main proc ... Get CPU usage and temperature - comp.os.ms-windows.programmer ...I don't understand why I obtain only strange ... Utilization for performance testing using /proc ... Monitoring CPU usage using vmstat and ... command which report Central ... ATARI and Spectrum are rubbish - The C64 is the king of home ...The sound isn't too bad also, but good results ... Atari BASIC wasn't good at all: slow, having a strange ... PROC REPORT / including an image but it not being a link ... iTunes Keeps Losing Albums - comp.sys.mac.apps... evidence I am suspicious that the problem results ... My first thought was: That's a really weird ... game on C64/128. - comp ..... to do this procedure leads you to use ... Need a FORTRAN compiler for Win7 (or XP) - comp.lang.fortran ...... me the source I can give it a try and report ... data with a listing if the expected results is ... That does seem > strange, though. > >> Thus, a procedure with an intent(in ... PROC REPORT: How To Get Startedstrange happens. Rather than listing ... Unexpected Results ----- PROC REPORT ... WHY PEOPLE DO/DO NOT USE PROC REPORT By now, it ... Mary Ainsworth | Strange Situation - Simply PsychologyStrange Situation Procedure. The security of attachment in one- to ... Her set of observational studies using the ‘Strange ... that these attachment styles were the result ... 7/18/2012 3:25:16 AM
|