BookmarkSubscribeRSS Feed
pallis
Fluorite | Level 6

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

22 REPLIES 22
DR_Majeti
Quartz | Level 8

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..

pallis
Fluorite | Level 6

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



DR_Majeti
Quartz | Level 8

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.

pallis
Fluorite | Level 6

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

pallis
Fluorite | Level 6

https://communities.sas.com/communications

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

pallis
Fluorite | Level 6

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

DR_Majeti
Quartz | Level 8

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

pallis
Fluorite | Level 6

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.

DR_Majeti
Quartz | Level 8

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

pallis
Fluorite | Level 6

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.

DR_Majeti
Quartz | Level 8

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

pallis
Fluorite | Level 6

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

pallis
Fluorite | Level 6

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

DR_Majeti
Quartz | Level 8

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..

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 22 replies
  • 2783 views
  • 0 likes
  • 2 in conversation