- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear Expert:
My program is as below. When I run the program the first time, I found that the name column is upper case , but subsequently I run the program, the name column became mixed case. We already know that Libname and Memname are stored in the views in upper case. But for name, does capitalization changes all the time?
Could you please help on this issue, thank you!
data test1;
set sashelp.vcolumn;
where LIBNAME = "WORK" and MEMNAME =upcase("TEST");
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
As long as the metadata of the columns is not changing, capitalization is constant of course (but , for name , can be mixed case indeed).
Use upcase function to make your query case insensitive:
data test1;
set sashelp.vcolumn;
where LIBNAME = "SASHELP" and MEMNAME = "CLASS"
and upcase(name)="HEIGHT";
run;
Koen
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Koen,
Thanks for your reply! I am sorry that, in my question, I forgot to describe one thing. It's that before run this proc sql, I will run the program to output 'TEST' dataset first. But the code for 'TEST' dataset didn't not change, I just rerun it. After that, I ran this proc sql, then the case of name changed. I am not sure if this is related to the code for 'TEST' dataset. But the first time I run these code, it will get the uppercase 'name'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Junhui1 wrote:
Hi Koen,
Thanks for your reply! I am sorry that, in my question, I forgot to describe one thing. It's that before run this proc sql, I will run the program to output 'TEST' dataset first. But the code for 'TEST' dataset didn't not change, I just rerun it. After that, I ran this proc sql, then the case of name changed. I am not sure if this is related to the code for 'TEST' dataset. But the first time I run these code, it will get the uppercase 'name'.
When you rerun code you replace the data set. So changes can happen on variable descriptions. If you aren't changing anything why are you rerunning your code?
You would have to provide the log from ALL code that creates or modifies the data set WORK.TEST in your current session to convince me that just "reran" without changes.
For example, Proc Datasets can change variable properties such as names and labels without affecting the code ran that creates the set.
Also if the code that creates Work.Test involves macro variables then the actual values of those macro variables may have changed the case of the name. If Work.Test is the output of a procedure then the input to the procedure may have changed.
If you are reading external data files with a tool such as Proc Import then variable names may change because the source files differed.
The above paragraph likely does not address all possibilities.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The most important thing I have learned from my time at IT support are these most-often told lies:
"I didn't do anything"
"I didn't change anything"
😉
Mind that, most often, these lies are not told consciously.
During the creation of variables, the case of variable names is set.
So
data test;
X = 1;
run;
and
data test;
x = 1;
run;
may be completely equivalent, but they will create upper- and lowercase variable names, respectively.