Hi,
I am running a program on SAS Enterprise Guide, that used to work everytime on earlier versions of SAS. When I get to the step below I receive the following message
data PosteriorProbabilities (keep=Site %VarStrg2(_,&MinGrp,&MaxGrp));
set TestOut;
run;
WARNING: The variable _1 in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable _2 in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable _3 in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 44 observations read from the data set WORK.TESTOUT.
NOTE: The data set WORK.POSTERIORPROBABILITIES has 44 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
Can anyone suggest why this would be happening? After this non of the tables in the program generate properly.
I am getting desperate.
Kind regards
Claire
Your dataset TESTOUT does not contain the variables listed in the warnings. It looks like it only contains one variable: SITE.
You will need to look at prior steps in your program to understand why these variables are not present.
Thank you. I am an old user of this script but never had to understand it before, so I am slowly figuring out how to read and understand the script. I have gone back through and had a look at the testOut and of the 22 columns there are three called 1,2 and 3. The posterior probability file also has columns labelled 1,2, and 3. Note that there is no underscore preceeding the numbers. Does the underscore matter?
1, 2 or 3 are _not_ valid SAS variable names (unless you use the '1'n construct, which I advise against). So what you see is most probably the variable label, which can be any text.
Valid SAS names need to start with a character or an underline.
Run a proc contents on the dataset to see what is actually in there.
I feel like you posted this question within the last couple days and got an answer, but I can't find it now....
My memory is your macro %VarStrg2 is designed to make a list. So if you submitted: %put %VarStrg2(Foo,1,5) ; the log would show:
Foo1 Foo2 Foo3 Foo4 Foo5
Is that right?
So in you program, it looks like the value of &MinGrp is 1 and the value of &MaxGrp is 3, so your DATA step becomes:
data PosteriorPriorities(keep=Site _1 _2 _3) ;
set TestOut ;
run ;
But, since the TestOut data set does not have variables named _1 _2 or _3, you end up with the PosteriorPriorities data set having only one variable, Site. See the log: "44 observations and 1 variables"
So if you really expect TestOut to have variables named _1 _2 _3, I would look into how that data set was made.
Thanks Quentin,
I had previously posted this on StackOverflow a few days ago but did not know there had been replies on that forum until your post on here. So apologies if I am accidentally over posting. You are correct in your interpretation of the macro, and the testout data set is the output of a discrim procedure.
Cheers
Hi, thanks for mentioning you had posted on S.O. I knew I had seen it *somewhere*. I think it's fair to post there and here, particularly since you allowed a few days for folks there to help first. They are different audiences, though of course plenty of overlap. I had thought you had posted *here* already and then deleted it, which of course would be poor netiquette.
Would follow Kurt's advice of running proc contents on TestOut to see what your variable names are.
I think if you set OPTIONS VALIDVARNAME=V7; it will fix your program.
Thank you so much
This has fixed the script.
Kind regards
Claire
@barelythere- Can you please post the answer , as I am also facing the same issue .
and not able to fix it.
Thanks & Regards,
Ritesh Srivastava
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.