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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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