Help using Base SAS procedures

proc summary nway help

Accepted Solution Solved
Reply
Super Contributor
Posts: 301
Accepted Solution

proc summary nway help

Hi everyone, I need help with this  for using proc summary....

I've got the next dataaset :
                          

                           Obs    VISit                  classy      pop    TREAT  

                              1    Baseline                Missing  1     Placebo    

                              2    Week 12 LOCF      I            1     Placebo    
                              3    Baseline                II           1     Placebo    
                              4    Baseline                II           1     Placebo    
                              5    Baseline                II           1     Placebo    
                              6    Baseline                II           1     Placebo   
                              7    Baseline                II           1     Placebo    
                              8    Baseline                II           1     Placebo    
                              9    Baseline                II           1     Placebo    
                             10    Baseline                II           1     Placebo    
                             11    Baseline                II           1     Placebo    
                             12    Baseline                II           1     Placebo    
                             13    Baseline                II           1     Placebo    

                             14    Baseline                II           1     Placebo    
                             15    Baseline                II           1     Placebo    
                             16    Baseline                II           1     Placebo    
                             17    Baseline                II           1     Placebo   
                             18    Baseline                II           1     Placebo    
                             19    Baseline                II           1     Placebo    
                             20    Baseline                II           1     Placebo    

                             21    Baseline                II           1     Placebo    
                             22    Baseline                II           1     Placebo    
                             23    Baseline                II           1     Placebo    
                             24    Baseline                II           1     Placebo    
                             25    Baseline                II           1     Placebo   

                             26    Baseline                II           1     Placebo    
                             27    Baseline                II           1     Placebo    
                             28    Baseline                II           1     Placebo   
                             29    Week 12 LOCF      II           1     Placebo  

I type:

  proc summary data=new nway;

     class treat classy visit;

     var pop;

     output out=newsum(drop=_Smiley Happy;

     run;

and I obtain:


                                  Obs    TREAt    class    VISit                  pop

                                    1    Placebo        I        Week 12 LOCF              1
                                    2    Placebo        I        Week 12 LOCF              1
                                    3    Placebo        I        Week 12 LOCF              1
                                    4    Placebo        I        Week 12 LOCF              1
                                    5    Placebo        I        Week 12 LOCF              .
                                    6    Placebo        II       Baseline                 26
                                    7    Placebo        II       Baseline                  1
                                    8    Placebo        II       Baseline                  1
                                    9    Placebo        II       Baseline                  1
                                   10    Placebo        II       Baseline                  0
                                   11    Placebo        II       Week 12 LOCF              1
                                   12    Placebo        II       Week 12 LOCF              1
                                   13    Placebo        II       Week 12 LOCF              1
                                   14    Placebo        II       Week 12 LOCF              1
                                   15    Placebo        II       Week 12 LOCF              .

I was expecting the real summary and as well the missing value, and it is not...what I am doing wrong here ?

Thanks in advance.


Accepted Solutions
Solution
‎04-13-2012 11:09 AM
Super Contributor
Posts: 301

Re: proc summary nway help

I got it Smiley Happy

proc summary data=new nway missing;

     class treattxt eff_rslt visder;

     var itt;

     output out=newsum(drop=_Smiley Happy n=n;

     run;

View solution in original post


All Replies
Solution
‎04-13-2012 11:09 AM
Super Contributor
Posts: 301

Re: proc summary nway help

I got it Smiley Happy

proc summary data=new nway missing;

     class treattxt eff_rslt visder;

     var itt;

     output out=newsum(drop=_Smiley Happy n=n;

     run;

Super User
Posts: 10,497

Re: proc summary nway help

If you want missing to be treated as a valid level of you class variable add the MISSING option to the class statement.

Class treat classy visit / missing;

You didn't request any summary functions for the variable. Request the statistics on the output statement.

output out=newsum(drop=_Smiley Happy sum= ;  if you only want sum if you want more statistics you'll need to provide output variable names for each statistic, syntax is

statistic-keyword<(variable-list)>=<name(s)>

or use the auto name option

output out=newsum(drop=_Smiley Happy sum std /autoname;


Super Contributor
Posts: 301

Re: proc summary nway help

I did it adding missing as an option of proc summary...I think will be the same.

Super Contributor
Posts: 1,636

Re: proc summary nway help

try adding sum=

proc summary data=new nway;

     class treat classy visit;

     var pop;

     output out=newsum(drop=_Smiley Happy sum=;

     run;

Linlin

Super Contributor
Posts: 301

Re: proc summary nway help

thnaks, I did with n

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 6263 views
  • 0 likes
  • 3 in conversation