Hi,
I have a new sql server table data source that I need to query but several of the variables have hyphens in the variable names.
I am using a SAS pass through query to access the SQL Server database/view.
How do I get SAS to accept the non standard names? I plan on renaming to change the hyphen to an underscore but right now I cannot even read them in.
Any assistance will be greatly appreciated.
Thanks,
Elliott
If you use this option SAS will automatically change the column names from hyphens to underscores when reading these tables:
options validvarname = V7;
If you need to refer to the original names in code then do this 'LETTER-REF-NUM'n
If you use this option SAS will automatically change the column names from hyphens to underscores when reading these tables:
options validvarname = V7;
If you need to refer to the original names in code then do this 'LETTER-REF-NUM'n
I have tried options validvarname = V7; and options validvarname = any; neither work, still erroring with not valid SAS name.
@Elliott wrote:
I have tried options validvarname = V7; and options validvarname = any; neither work, still erroring with not valid SAS name.
This should work. Please provide the code and log where you still encounter errors.
I was able to read in the data using "LETTER-REF-NUM"n
Thanks All for your help.
Elliott
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.