Help using Base SAS procedures

Import Of Access To SAS with Converted Non-Standard Variable Names

Reply
Contributor
Posts: 24

Import Of Access To SAS with Converted Non-Standard Variable Names

EG 4.1 imports a MS Access table which has invalid column names, as an example

2009 subs total

Total # Of Subs

.... etc....

I look at the generated code by sas and it creates  _T_ value to process the observations, and creates the SAS Dataset.

The strange thing is that SAS outputs the dataset with non-standard variable names, which causes me the problem.

I would have thought SAS would have kept the _T_ or someting like that...

I want to re-name all the variables to someting like:

Rename 2009 subs total = Y2009_Subs_Total;

But SAS looks at the 2009 as a numeric not as a variable name...

Any ideas on how I can take a variable named 2009 subs total and rename it to Y2009_Subs_Total?

TIA, Jay

PROC Star
Posts: 7,492

Import Of Access To SAS with Converted Non-Standard Variable Names

State the variable name as a name literal in your rename statement.  see:

http://support.sas.com/documentation/cdl/en/lrcon/62753/HTML/default/viewer.htm#p18cdcs4v5wd2dn1q0x2...

You would have to have the validvarname=any option set as well

Contributor
Posts: 24

Import Of Access To SAS with Converted Non-Standard Variable Names

Ah, just figured it out the 'n option works, it takes the 'value of' the 'string' not the string... cool....

Super User
Posts: 10,046

Import Of Access To SAS with Converted Non-Standard Variable Names

For SAS/EG system option validvarname= is set 'any' by default.

You should set it back at the first of your code . validvarname=v7.

Ksharp

Ask a Question
Discussion stats
  • 3 replies
  • 125 views
  • 0 likes
  • 3 in conversation