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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1010 views
  • 1 like
  • 5 in conversation