BookmarkSubscribeRSS Feed
nupedoc79
Fluorite | Level 6

I hear this a lot from people and I've said it a few times myself and find myself saying it today, "I written SAS code like this a thousand times without issue".... Any way the below code issues the ERROR: Variable DATACOLLECTION_FINISHTIME not found

 

proc tabulate data=&CMTH&YR._MAS_IIS_MOB_SF_NEW missing;
var DATACOLLECTION_FINISHTIME;
table DATACOLLECTION_FINISHTIME, n nmiss (min max median)*f=mmddyy10. range;
run;

A second pair of eyes would help. Thanks....

 

 

 

 

 

 

8 REPLIES 8
pink_poodle
Barite | Level 11
Does PROC CONTENTS show that the variable exists?
SASKiwi
PROC Star

This is a guess without seeing your SAS log. You might need an extra dot for your SAS dataset macro variables name to resolve correctly:

proc tabulate data=&CMTH&YR.._MAS_IIS_MOB_SF_NEW

It depends on where the LIBREF and DATASET boundary is. 

nupedoc79
Fluorite | Level 6
I resolved the issue. Thanks everyone
nupedoc79
Fluorite | Level 6

I verified the variable opening up and reviewing the SAS work dataset and the variable is present.

Reeza
Super User
Run the proc contents, the variable name and label may be the issue.
Show the proc contents please.
sbxkoenk
SAS Super FREQ

Hello @nupedoc79 ,

 

Have a look to the output of this little program :

%PUT &=CMTH.;
%PUT &=YR.; 
proc contents data=&CMTH&YR._MAS_IIS_MOB_SF_NEW /* directory */ details;
title 'Contents Using the DETAILS Option';
run;

Are you sure you want to resolve both macro variables simultaneously? Maybe you want one of these to be resolved first such that a new macro variable name is constructed. The new macro variable name is then resolved in a "second round" by the macro processor.

 

Koen

nupedoc79
Fluorite | Level 6

You point is well taken. The two SAS macro variables resolve successfully in prior code in the program. I will however try your suggestion. Thanks

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 8 replies
  • 634 views
  • 1 like
  • 5 in conversation