- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I am trying to use the UPCASE function to make values in column "Login" from lowercase to uppercase, pasting it into column "USERID. my issue is im gettting blanks in return.
The layout of the Logins are 3 characters and 3 numbers, for example: aaa222, aaa333, aaa444, etc.
I would like these to be: AAA222, AAA333, AAA444, etc.
Here is my code:
data work.people;
set work.people;
Login=upcase(USERID);
run;
This is what my output looks like:
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your description does not match what your code does. Try swapping your columns around:
* Current; Login=upcase(USERID);
* Suggested; USERID=upcase(Login);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@JibJam221 wrote:
Hi everyone,
I am trying to use the UPCASE function to make values in column "Login" from lowercase to uppercase, pasting it into column "USERID. my issue is im gettting blanks in return.
The layout of the Logins are 3 characters and 3 numbers, for example: aaa222, aaa333, aaa444, etc.
I would like these to be: AAA222, AAA333, AAA444, etc.
Here is my code:
data work.people;
set work.people;Login=upcase(USERID);
run;
This is what my output looks like:
You have two problems. First, you are using UPCASE on a numeric variable, Userid, which is missing for all of the values your pictures shows. So you create an character value from a missing number and default display for missing is a period, which does not have an uppercase version. Second that number would in no manner contain "aaa" and the AAA would have to come from somewhere else.
One suspects that you think Userid should have letters but for some reason it is numeric. Which means any "userid" that might have had letters somewhere has lost them when this version of the variable was created.
BTW the reason you see a dot so far from the left margin is when you convert numeric variables without explicit controls the likely default format used is best12 and will have the dot in the 12th character position from the left.
Did you read your log? I bet there is a Note about "numeric values have been converted to character" somewhere which would tell you if you haven't looked lately that Userid is numeric.
Habitual use of the construct
data work.people; set work.people;
with the same data set on set and Data statements will lead to problems if you make a logic mistake as using code this way completely replaces the source data. I suspect that may be what somewhat related to your missing Userid values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
According the to screenshot you included, USERID is a numeric variable. It can happen if you use a wrong variable name and the DATA step will make a variable with that spelling, numeric by default.
Are you certain that's the name of the variable you want to transform?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your description does not match what your code does. Try swapping your columns around:
* Current; Login=upcase(USERID);
* Suggested; USERID=upcase(Login);