- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA _null_; Threshold=250000; call symput('u_Threshold',trim(Threshold)); RUN;
Please see above code. I do not understand, since threshold is already hard coded, I do not know why there is the need for trim(thresold).
Anyone gives me the exaplanation?
And what if I replace this with symputx?
Thank you
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You cannot use PUT. You must use %PUT. Then you will see 12 characters appear between the two asterisks.
Yes, if you use SYMPUTX you do not need TRIM (or STRIP or LEFT or COMPRESS) ... all leading and trailing blanks will be gone. You can see that in the same way (with %PUT).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you were to examine the value of &U_THRESHOLD, you would find it contains 12 characters: 6 blanks followed by 6 digits. You can see this easily using:
%put *&u_threshold*;
Since there are no trailing blanks, TRIM would not affect the result. However, STRIP would remove both leading and trailing blanks, and would make a difference.
The extra blanks get added because the second parameter to CALL SYMPUT is supposed to be a character string. When a numeric is supplied, it forces SAS to make a numeric-to-character conversion. You can see that this took place, by reading the log.
CALL SYMPUTX would make a difference. Although it still must perform the numeric-to-character conversion, it also removes the leading blanks that result. &U_THRESHOLD would be only 6 characters long. Also, the note in the log about numeric-to-character conversion would disappear when using CALL SYMPUTX.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you explain?
Do you mean, when I type, "put *&u_threshold*;" I can see it contains 12 characters?
Do you mean, if I use CALL SYMPUTX , I do not need to use "Trim"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You cannot use PUT. You must use %PUT. Then you will see 12 characters appear between the two asterisks.
Yes, if you use SYMPUTX you do not need TRIM (or STRIP or LEFT or COMPRESS) ... all leading and trailing blanks will be gone. You can see that in the same way (with %PUT).