04-01-2015 08:13 PM
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));
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.
04-01-2015 08:31 PM
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.
04-02-2015 12:17 AM
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?
04-02-2015 02:44 AM
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.
04-01-2015 08:52 PM
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 ;
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.
04-02-2015 12:23 AM
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.
04-02-2015 10:12 AM
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.
07-14-2016 06:32 AM
@barelythere- Can you please post the answer , as I am also facing the same issue .
and not able to fix it.
Thanks & Regards,