Architecting, installing and maintaining your SAS environment

Proc Report

Reply
Contributor
Posts: 71

Proc Report

Help need for Report Procedure.

code  l       Jun13 |  jul 13 | aug 13   l

         l   --------------|----------|------------- l

         l     a|b |c    | a |b| c |  a b c     l total

---------|----------------- |----------|--------------|--------------

Im looking for output like this I have 3 columns I need to create this kind of layout accordingly.

Any hints please               

regards

venky

Contributor
Posts: 64

Re: Proc Report

Hi Pallis,

You need a report for every date with subgroup of a,b,c ????

If it is, in column statement give a try like this (month*variable name[which contain a b c values]).

I hope this works for you..

Contributor
Posts: 71

Re: Proc Report

Posted in reply to DR_Majeti

HI Durga,

(month*variable name[which contain a b c values])


'*' works in proc tabulate. But it dont work in proc report. I mean here it's not working for me it's showing error.

Regards,

venky



Contributor
Posts: 64

Re: Proc Report

hi

I have gone some other material and please try this method once..

Column var1 var2 (month,variable name[which contain a b c values] );

I think it might work definitely ... please try this also..

thank you.

Contributor
Posts: 71

Re: Proc Report

Posted in reply to DR_Majeti

Thank you M/S Durga for the reply.

This is how I'm getting error

ERROR: A GROUP variable appears above or below other report items.

       Name                              Usage

       --------------------------------  --------

       MONTH                             COMPUTED

       PAYMENT_STATUS                    GROUP

Contributor
Posts: 71

Re: Proc Report

https://communities.sas.com/communications

Actually please go through the post which. I put the issue in wrong place. Sorry for that.

Contributor
Posts: 71

Re: Proc Report

Let me tell you with my real column name

code, status, date

In code I have different numbers

In Status I have different values like CLR,UCL,HLD

In date i have from june to aug data

Im looking for the output like

in month wise based on status whats the count.

Ex:

      JUN13               JUL 13                           AUG13                 TOTAL

CLR,UCL,HLD       CLR,UCL,HLD                 CLR,UCL,HLD

2       3     4            1        6   7                      1      4       5               34

Contributor
Posts: 64

Re: Proc Report

Proc report data=have ;

Column id (month, payment_status);

Define id / display;

define month / across group ;

define payment_status/  ' ';

define total / display;

compute total;

    total=(_c2_,_c3_,_c4_,_c5_,_c6_,_c7_,_c8_,_c9_,_c10_);

endcomp;

run;

even month is computed later you can give it like this , but you will give computed before across..

Message was edited by: Durga R Majeti

Contributor
Posts: 71

Re: Proc Report

Posted in reply to DR_Majeti

Proc report data=bncd_jun_jul_aug2 nowd  ;

Column CODE (date, payment_status);

Define CODE / display;

define date / across group ;

define payment_status/  ' ';

define total / display;

compute total;

    total=(_c2_,_c3_,_c4_,_c5_,_c6_,_c7_,_c8_,_c9_,_c10_);

endcomp;

run;

ERROR: A GROUP variable appears above or below other report items.

       Name                              Usage

       --------------------------------  --------

      DATE                           GROUP

     PAYMENT_STATUS                    DISPLAY

WARNING: total is not in the report definition.

Contributor
Posts: 64

Re: Proc Report

hmm then remove group and place it as display only .. and please add sum function for total variable..

Contributor
Posts: 71

Re: Proc Report

Posted in reply to DR_Majeti

proc report DATA=bncd_jun_jul_aug1

NOWD headline  ;

COLUMN CODE PAYMENT_STATUS   DATE;

Define CODE/ group  missing ;

Define PAYMENT_STATUS / group  width=7   ;

Define  date/ group  across  format=monyy5. width=7  ;

Define total / display computed format=comma10.2 'Total' ;

compute total;

total=sum(cutdate);

endcomp;

run;

Actually I modifed the code to get  :

                                                 DATE

CODE STATUS       JUN13 JUL13 AUG13

------------------------------------------------------------

1              CLR             22        33              12

                UCR             1           121           11

                HLD              67          3           22

I don't understand why total not displaying .

Unfortunately my boss is not Accepting and :smileyangry: on me. Saying its possible get it.

Contributor
Posts: 64

Re: Proc Report

hey can u send a sample data i will try to crack it..  you should get it like this or before?

Contributor
Posts: 71

Re: Proc Report

Posted in reply to DR_Majeti

I'm sorry. I'm not supposed to send data.  I can give some data  how it's

Code       Date               Status

                  30/6/2013      CLR

                  30/6/2013     HLD

1               30/6/2013       UCL

100           30/6/2013      UCL

.......................................................

.......................................................

30000     31/7/2013       UCL

                  31/8/2013      CLR

                  31/8/2013      HLD

1               31/8/2013       UCL

100           31/8/2013      UCL

.......................................................

.......................................................

30000     30/8/2013       UCL

This kind of data I'm having

Contributor
Posts: 71

Re: Proc Report

Is it possible to have three way reporting in proc report as we can do in proc tabulate.

Contributor
Posts: 64

Re: Proc Report

Hi..

Please check this code .. this might help you in some way...

data have;                                                                                                                                       
input code date:ddmmyy10. status $;                                                                                                               
format date ddmmyy10.;                                                                                                                            
datalines;                                                                                                                                        
1 30/6/2013 CLR                                                                                                                                   
1 30/6/2013 NCL                                                                                                                                   
1 30/6/2013 UCL                                                                                                                                   
100 30/6/2013 UCL                                                                                                                                 
100 31/7/2013 UCL                                                                                                                                 
100 31/8/2013 CLR                                                                                                                                 
101 31/8/2013 NCL                                                                                                                                 
101 31/8/2013 UCL                                                                                                                                 
101 31/8/2013 UCL                                                                                                                                 
;                                                                                                                                                 

run;

proc report data=have nowd;                                                                                                                       
Column Code (Date,status) total;                                                                                                                  
Define code / display;                                                                                                                            
Define Date / across ;                                                                                                                            
Define Status / across ;                                                                                                                          
Define total / computed;                                                                                                                          
Compute total;                                                                                                                                    
  total=sum(_c2_,_c3_,_c4_,_c5_,_c6_,_c7_,_c8_,_c9_,_c10_);                                                                                       
endcomp;                                                                                                                                          

Run;

Hey run this code completely as it is you will be able to get some idea..

Ask a Question
Discussion stats
  • 22 replies
  • 1066 views
  • 0 likes
  • 2 in conversation