BookmarkSubscribeRSS Feed
JaySwan
Calcite | Level 5

We have a job that reads in an MS Access table with a variable named 1Quarter.

Not having any luck renaming the variable to a SAS compliant name.

Any ideas?

Our last option would be to go back into MS Access and rename it before the import, just want to check to see if there is another way to rename.

TIA J

4 REPLIES 4
art297
Opal | Level 21

I would think that SAS would convert the name to be _1Quarter.  You could change it to be either Quarter1 or Quarter_1.

JaySwan
Calcite | Level 5

I sort of brute forced this one for now, exported into excel then created a new dataset in sas with correct names and imported...

Not a 100% solution but ok for now...

Thanks, Jay

Ksharp
Super User

You need:

options validvarname=any;

Ksharp

DouglasMartin
Calcite | Level 5

I had similar problems a few years ago when I was having SAS "talk to" Access a lot. In addition to options validvarname=any that Ksharp mentioned, you will probably need to use name literals (I think that's what their official name is), e.g. "1Quarter"n (note the n following the quote to indicate it is a name, not a string).

Try something like

options validvarname=any;

data new;

     set old;

     rename "1Quarter"n = Quarter1;

run;

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!

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
  • 4 replies
  • 864 views
  • 0 likes
  • 4 in conversation