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

I am not sure why I am getting this error.  

 

 

data have;
input start_date :date11.;

a=' 23:59:59 ';
b=put(start_date, yymmddd10.);
result=cat(b,a);
put result $char.;

datalines;
31MAY2020
;
run;

data _null_;
valueStmt=cats('write values "RequestTime" "',&result,'";');
put valueStmt;
run;

22
23 GOPTIONS ACCESSIBLE;
24 data have;
25 input start_date :date11.;
26
27 a=' 23:59:59 ';
28 b=put(start_date, yymmddd10.);
29 result=cat(b,a);
30 put result $char.;
31
32 datalines;

2020-05-31 23:59:59
NOTE: The data set WORK.HAVE has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

34 ;

35 run;
36
37 data _null_;
38 set have;
39 valueStmt=cats('write values "RequestTime" "',&result,'";');
_
22
WARNING: Apparent symbolic reference RESULT not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, INPUT, PUT.

40 put valueStmt;
41 run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
39:48
2 The SAS System 08:31 Tuesday, July 21, 2020

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Macro variable &result has never been assigned a value. So the SAS code doesn't know what to do when it sees &result.

 
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Macro variable &result has never been assigned a value. So the SAS code doesn't know what to do when it sees &result.

 
--
Paige Miller
niejung
Obsidian | Level 7

I added this line code on the top and worked.  Thank you very much!

 

 

%let result2=put(%UNQUOTE(%STR(%'&result1%')),20.);

 

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
  • 2 replies
  • 6272 views
  • 0 likes
  • 2 in conversation