12-06-2016 03:58 PM
I am new to the SAS Studio OnDemand. I imported a data set into my library in SAS Studio and I can see that I do have a character variable by the name "Coverage Major" in a data set named as Glass. To limit my analysis to only the "PD" type of the coverage, I wrote the following line in my code:
but I got an error message saying that "variable coverage_major is not on file SASUSER.GLASS". I also tried writing the name of the variable as "coverage major" or "Coverage_Major", but still get the same error message. Any clue?
12-06-2016 05:14 PM
12-06-2016 07:42 PM
That data set is using a feature that is not popular among some of the more conservative SAS users, such as myself, that allows variable names with spaces and such. One reason is the problem you already discovered. To use literal names like that you have to enclose the variable name in quotes and have an n immediately following the last quote:
You may get tired of typing all those quotes and n. I find it tedious and either avoid creating variables with those names or rename for my use as possible.
12-06-2016 07:46 PM
If you have a program you're working on and can rerun your analysis without too much issue, I would consider setting your validvarname option to V7. Then you'll have the standard SAS names you expect. Otherwise, you'll need to keep typing your spaces and quotation marks, and guessing at variable names vs labels.