BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jacksonan123
Lapis Lazuli | Level 10

I have a data set named param.tbl which contains data that looks like this:

ID          TIME        CMT         AGE         ETA1                         

1.0000E+00 0.0000E+00 1.0000E+00 1.2000E+01 7.4460E-01

1.0000E+00 0.0000E+00 2.0000E+00 1.2000E+01 7.4460E-01

1.0000E+00 0.0000E+00 3.0000E+00 1.2000E+01 7.4460E-01

 The actual data set has about 500 rows and I have presented a 3 row sample.

 

When I use the code below, I get the log below, and the data is not read in. Can someone tell me how to correct the code so that the data will be read into SAS?

 

LOG

NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
2 TITLE;
3 FOOTNOTE;
4 OPTIONS LOCALE=en_US DFLANG=LOCALE;
5 DATA _NULL_;
6 RUN;
7 OPTIONS VALIDVARNAME=V7;
8 OPTIONS VALIDMEMNAME=EXTEND;
9 FILENAME _HTMLOUT TEMP;
10 FILENAME _RTFOUT TEMP ENCODING='UTF-8';
11 FILENAME _PDFOUT TEMP;
12 FILENAME _GSFNAME TEMP;
13 FILENAME _DATAOUT TEMP;
14 %LET SYSCC=0;
15 %LET _CLIENTAPP='SAS Studio';
16 %LET _CLIENTAPPABREV=Studio;
17 %LET _CLIENTAPPVERSION=3.8;
18 %LET _CLIENTVERSION=3.8;
19 %LET _CLIENTMODE=basic;
20 %LET _SASSERVERNAME=%BQUOTE(localhost);
21 %LET _SASHOSTNAME=%BQUOTE(localhost);
22 %LET _SASPROGRAMFILEHOST=%BQUOTE(localhost);
23 %LET _CLIENTUSERID=%BQUOTE(sasdemo);
24 %LET _CLIENTUSERNAME=%BQUOTE(sasdemo);
25 %LET CLIENTMACHINE=%BQUOTE(192.168.61.1);
26 %LET _CLIENTMACHINE=%BQUOTE(192.168.61.1);
27 %let SASWORKLOCATION="%sysfunc(getoption(work))/";
28 FILENAME _CWD '.';
29 DATA _NULL_;
30 CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
31 RUN;
32 FILENAME _CWD;
33
34 %LET _SASPROGRAMFILE = %NRQUOTE(%NRSTR(/folders/myfolders/BOOTSTRAPAPTENSIO_PED/ReadFitFile.sas));
35 %LET _BASEURL = %BQUOTE(http://192.168.61.128/SASStudio/);
36 %LET _EXECENV=SASStudio;
 
______________________________________________________________________________________________________________________
49
 
 
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.
 
37 DATA _NULL_;
38 CALL
38 ! SYMPUT("GRAPHINIT"
_
49
38 ! ,"");
39 CALL
39 ! SYMPUT("GRAPHTERM"
_
49
 


 

I have attached code written to read the data set.

%do i=1% to 5;
data NEW_SUBJ&i;
infile "/folders/myfolders/test&i..nm7/PARAM.TBL"  FIRSTOBS=2;
input ID TIME CMT AGE ;
RUN;

DATA NEW_SUBK&i;
SET NEW_SUBJ&i;
IF ID=. THEN DELETE;
RUN;
%END;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You seem to be using an interface like Enterprise Guide or SAS/Studio that submits your code to a remote SAS server.  The error message is probably related to unbalanced quotes. Try restarting the SAS session you are using to run the code and see if that helps.

 

Your posted code has two obvious problems. First is the misplaced % on the %TO part of your %DO loop.

Second is that to use a %DO loop you need to wrap that code into a macro definition. Which means you also need to call the macro once it is defined.

 

So try something like this:

%macro read5;
%do i=1 %to 5;

data NEW_SUBJ&i;
  infile "/folders/myfolders/test&i..nm7/PARAM.TBL" firstobs=2 truncover;
  input ID TIME CMT AGE ;
  if id=. then delete;
run;

%end;
%mend read5;

options mprint;
%read5;

Turning on the MPRINT option will have SAS show the lines of code that the macro generates in the LOG.

 

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

They key is this

NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.

at the beginning of the log. You had unbalanced quotes in previous code. Restart your SAS session and run the code again.

jacksonan123
Lapis Lazuli | Level 10
A solution was supplied by a later reply by using a macro and correcting the
do loop.
jklaverstijn
Rhodochrosite | Level 12

After several minutes of staring at your code wondering what could be wrong it struck me:

 

%do i=1% to 5;

is probably a typo for for this intended code:

 

%do i=1 to 5;

The percent sign after the 1 probably yields the message you get, although I didn't test that.

 

Hope this helps,

-- Jan.

jacksonan123
Lapis Lazuli | Level 10
This would work in side a macro as suggested by a later reply.
Tom
Super User Tom
Super User

You seem to be using an interface like Enterprise Guide or SAS/Studio that submits your code to a remote SAS server.  The error message is probably related to unbalanced quotes. Try restarting the SAS session you are using to run the code and see if that helps.

 

Your posted code has two obvious problems. First is the misplaced % on the %TO part of your %DO loop.

Second is that to use a %DO loop you need to wrap that code into a macro definition. Which means you also need to call the macro once it is defined.

 

So try something like this:

%macro read5;
%do i=1 %to 5;

data NEW_SUBJ&i;
  infile "/folders/myfolders/test&i..nm7/PARAM.TBL" firstobs=2 truncover;
  input ID TIME CMT AGE ;
  if id=. then delete;
run;

%end;
%mend read5;

options mprint;
%read5;

Turning on the MPRINT option will have SAS show the lines of code that the macro generates in the LOG.

 

jacksonan123
Lapis Lazuli | Level 10

Once I used the macro and edited the do loop it ran with no problem.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1585 views
  • 3 likes
  • 4 in conversation