BookmarkSubscribeRSS Feed
barelythere
Calcite | Level 5

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

9 REPLIES 9
SASKiwi
PROC Star

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.

barelythere
Calcite | Level 5

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?

Kurt_Bremser
Super User

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.

Quentin
Super User

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
barelythere
Calcite | Level 5

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

Quentin
Super User

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
barelythere
Calcite | Level 5

Thank you so much

This has fixed the script.

Kind regards

Claire

Riteshdell
Quartz | Level 8

@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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 9 replies
  • 22275 views
  • 6 likes
  • 6 in conversation