in your example compress will create the text string "YearE/monthasked". Assuming that "YearE" and "monthasked" are numeric it convert them and suppress any space characters that might be included in the conversion. Without the compress function you might get something like " YearE"/" monthasked".
I often use compress in just this fashion to convert text to numeric.
One thing to note. SAS is quite forgiving about doing this sort of thing (using a character function on a numeric field) and will just convert the numeric to a char. However, if you start using Enterprise Guide, you'll have to be alot more careful, it doesn't seem to do that anymore and will actually give an error message along the lines of "invalid type for argument to character function COMPRESS" or something like that. You have to learn to use your PUT() and INPUT() functions then to convert your variables.
Just a word of warning.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.