BookmarkSubscribeRSS Feed
nrk1787db1
Obsidian | Level 7

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 ?

 

6 REPLIES 6
data_null__
Jade | Level 19
RTM

SUMLABEL NOSUMLABEL SUMLABEL='RTM'
nrk1787db1
Obsidian | Level 7

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?                 

 

ballardw
Super User

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

nrk1787db1
Obsidian | Level 7

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 ;                                      
data_null__
Jade | Level 19
The extensions to SUMLABEL seem to only exist in SAS 9.4. I Don't see how it can be done using earlier versions.
nrk1787db1
Obsidian | Level 7

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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1494 views
  • 2 likes
  • 3 in conversation