DATA Step, Macro, Functions and more

PROC PRINT - BY - unwanted variable in the output

Reply
Contributor
Posts: 25

PROC PRINT - BY - unwanted variable in the output

Hi,

 

I'm working on a simple report and getting stuck at a point

 

I'm running below snippet for printing the data after all the work is done

 

PROC PRINT DATA = R LABEL NOOBS ;
 VAR   TRAN_DATE                 
       DEP_AMTN                  
       TRANRMKS ;                
 SUM   DEP_AMTN ;                
 BY    T_MONTH ;                 
 WHERE DEP_AMTN > 0 ;            
RUN ; 

I'm getting the expected output but with a "T_MONTH" on the left side of the total amount generated by SUM(DEP_AMTN) statement as below

 

 

TRANSACTION MONTH=1                                                
                                                                   
TRANSACTION         DEPOSIT                                        
   DATE              AMOUNT            TRANSACTION REMARKS         
                                                                   
02-Jan-2015          100.00                 ABCDEF
30-Jan-2015        48953.00                 GHIJKL
-----------    ------------                                        
T_MONTH            49053.00                                        

Could anyone help me to get rid of it ?

 

Respected Advisor
Posts: 3,799

Re: PROC PRINT - BY - unwanted variable in the output

Posted in reply to nrk1787db1_gmail_com
RTM

SUMLABEL NOSUMLABEL SUMLABEL='RTM'
Contributor
Posts: 25

Re: PROC PRINT - BY - unwanted variable in the output

Posted in reply to data_null__

Hi data_null_,

 

Thank you for your response, I'm running this code in z/Os environment, perhaps I should have begin with this in my first post.

 

If I use SUMLABEL alone with LABEL (as below)

 

PROC PRINT DATA = R LABEL SUMLABEL NOOBS ;
 VAR   TRAN_DATE                 
       DEP_AMTN                  
       TRANRMKS ;                
 SUM   DEP_AMTN ;                
 BY    T_MONTH ;                 
 WHERE DEP_AMTN > 0 ;            
RUN ; 

then I get below output

 

 

TRANSACTION MONTH=1                                                       
                                                                          
                          DEPOSIT                                         
TRANSACTION DATE           AMOUNT            TRANSACTION REMARKS          
                                                                          
02-Jan-2015                100.00    		   ABCDEF
30-Jan-2015              48953.00    		   GHIJKL 
-----------------    ------------                                         
TRANSACTION MONTH        49053.00 

T_MONTH is now TRANSACTION MONTH

 

 

But when I try using NOSUMLABEL or SUMLABEL='RTM' then SAS displays below error message:

 

ERROR 22-322: Syntax error, expecting one of the following: ;, BLANKLINE, DATA,  DOUBLE, HEADING, LABEL, N, NOOBS, OBS, ROUND, ROWS, SPLIT, STYLE, SUMLABEL, UNIFORM, WIDTH.        

 

Can you please help?                 

 

Super User
Posts: 11,343

Re: PROC PRINT - BY - unwanted variable in the output

Posted in reply to nrk1787db1_gmail_com

Please show the code you attempted to use that generated the error message. You may have set the option incorrectly.

Contributor
Posts: 25

Re: PROC PRINT - BY - unwanted variable in the output

Hi ballardw,

 

I used below code

 

PROC PRINT DATA = R NOSUMLABEL NOOBS ;     
 VAR   TRAN_DATE                           
       DEP_AMTN                            
       TRANRMKS ;                          
 SUM   DEP_AMTN ;                          
 BY    T_MONTH ;                           
 WHERE DEP_AMTN > 0 ;                      
RUN ;                                      
Respected Advisor
Posts: 3,799

Re: PROC PRINT - BY - unwanted variable in the output

Posted in reply to nrk1787db1_gmail_com
The extensions to SUMLABEL seem to only exist in SAS 9.4. I Don't see how it can be done using earlier versions.
Contributor
Posts: 25

Re: PROC PRINT - BY - unwanted variable in the output

Posted in reply to data_null__

Hi Data _null_,

 

Thank you for your promt response, I'm running this on 9.3 so till our SAS gets upgraded to 9.4 I'll keep this in progress

Ask a Question
Discussion stats
  • 6 replies
  • 295 views
  • 2 likes
  • 3 in conversation