BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
robm
Quartz | Level 8

I have the following code


libname ROBM "F:\robm";
OPTIONS VALIDVARNAME=ANY;
  proc tabulate data=ROBM.TABBS99991 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
   var INCLUDED_TUITION;
   keylabel Sum = " ";
   table ('ALLOCATED_COLLEGE'n = ") *('SUBJECT_DESC'n= " all = 'Total') all='Total', (('TERM_CODE'n = " all = 'Total')*((N = Amount))) /
                  contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};
  run;

 

but when i run it I get the error complaning about quouted string I inserted spaces so I am not sure what the problem is any ideas?

 

229  libname ROBM "F:\robm";
NOTE: Libref ROBM was successfully assigned as follows:
      Engine:        V9
      Physical Name: F:\robm
230
231  OPTIONS VALIDVARNAME=ANY;
232
233
234
235
236
237    proc tabulate data=ROBM.TABBS99991 missing contents = ' ' format=COMMA6.0
237! S=[foreground=highlight.];
238     class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
239     var INCLUDED_TUITION;
240     keylabel Sum = " ";
241     table ('ALLOCATED_COLLEGE'n = ") *('SUBJECT_DESC'n= " all = 'Total') all='Total',
241! (('TERM_CODE'n = "
                      -
                      49
241!  all = 'Total')*((N = Amount))) /
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release.
              Inserting white space between a quoted string and the succeeding identifier is
             recommended.

242                    contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};
243    run;
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

One guess:  It looks like the intent was to remove the variable name from the table.  If that's the case, the right syntax would use a blank within quotes:

 

table (ALLOCATED_COLLEGE = ' ') *(SUBJECT_DESC = ' ' all = 'Total') all='Total', ((TERM_CODE = ' ' all = 'Total')*((N = 'Amount'))) /
                  contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};

 

Note that I also added quotes around the word Amount which looks like it should be the label for the N statistic. 

View solution in original post

7 REPLIES 7
art297
Opal | Level 21

You didn't provide any data so we can't test your code, but the individual double quotes in the following lines are likely your problem:

 

241     table ('ALLOCATED_COLLEGE'n = ") *('SUBJECT_DESC'n= " all = 'Total') all='Total',
241! (('TERM_CODE'n = "
 

Art, CEO, AnalystFinder.com

 

robm
Quartz | Level 8

that makes sense now that you point that out but when I remove them I still get the message just in another spot any idea

 

16   libname ROBM 'F:\robm';
NOTE: Libref ROBM was successfully assigned as follows:
      Engine:        V9
      Physical Name: F:\robm
17
18   OPTIONS VALIDVARNAME=ANY;
19
20
21
22
23
24     proc tabulate data=ROBM.TABBS99991 missing contents = ' ' format=COMMA6.0
24 ! S=[foreground=highlight.];
25      class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
26      var INCLUDED_TUITION;
27      keylabel Sum = ' ';
28      table ('ALLOCATED_COLLEGE'n = ) *('SUBJECT_DESC'n=  all = 'Total') all='Total', (('TERM_CODE'n
                                      -
                                      22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a format name.

28 !    table ('ALLOCATED_COLLEGE'n = ) *('SUBJECT_DESC'n=  all = 'Total') all='Total', (('TERM_CODE'n
                                                                -
-
                                                                22
22
28 !  =  all = 'Total')*((N = Amount))) /
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.
29                     contents = ' ' misstext=' ' box={label = ALLOCATED_COLLEGE/SUBJECT_DESC};
                                                                                 -
                                                                                 22
                                                                                 200
ERROR 22-322: Syntax error, expecting one of the following: LABEL, STYLE, }.
ERROR 200-322: The symbol is not recognized and will be ignored.
30     run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE TABULATE used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds


Reeza
Super User

It's not an ERROR, it's a WARNING and won't impact your results.

 

Is there a specific reason you're using named literal convention for variables when you don't have spaces in the names?

Is the code you posted first with/without the 'spaces you added'?

 

This usually refers to cases where you have something like the following, a character other than n/d/dt after a quoted string. You can add a space after the quotation marks and that should resolve the issues. It's hard to see from the code where the issue is being identified, but I'd probably add spaces after all the quotation marks in turn until it disappeared. 

 

'my string')

 

art297
Opal | Level 21

I don't know what you want your table to look like, but the following modifications to your code produce a table without any errors or warnings:

 

proc import datafile='/folders/myfolders/book1.xlsx'
   out=TABBS99991 dbms=xlsx replace;
proc tabulate data=TABBS99991 missing contents = ' ' format=COMMA6.0 S=[foreground=highlight.];
   class 'ALLOCATED_COLLEGE'n 'SUBJECT_DESC'n 'TERM_CODE'n;
   var INCLUDED_TUITION;
   keylabel Sum = " ";
   table ('ALLOCATED_COLLEGE'n) *('SUBJECT_DESC'n all = 'Total') all='Total', (('TERM_CODE'n  all = 'Total')*((N = Amount))) /
                  contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};
 run;

However, out of curiosity, why are you using named literals since all of your variables are valid SAS names?

 

Art, CEO, AnalystFinder.com

Astounding
PROC Star

One guess:  It looks like the intent was to remove the variable name from the table.  If that's the case, the right syntax would use a blank within quotes:

 

table (ALLOCATED_COLLEGE = ' ') *(SUBJECT_DESC = ' ' all = 'Total') all='Total', ((TERM_CODE = ' ' all = 'Total')*((N = 'Amount'))) /
                  contents = ' ' misstext=' ' box={label = "ALLOCATED_COLLEGE/SUBJECT_DESC"};

 

Note that I also added quotes around the word Amount which looks like it should be the label for the N statistic. 

Tom
Super User Tom
Super User

The original program was using a single double quote character where you meant to use a blank string literal. 

You had " where you needed ' ' or " ".

This also caused you to have unbalanced quotes since your program had an odd number of double quote characters.

Once you change the double quote characters into quoted spaces instead you will probably still need to deal with the left over effect of submitting the original program with the unbalanced double quotes.

robm
Quartz | Level 8

got it that makes sense now thanks all

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
  • 7 replies
  • 1211 views
  • 0 likes
  • 5 in conversation