I am trying to do an advance filter in a column I have named "Wages". This column is made up of random numbers of dollars amounts in dollar20. format.
I want to do a query were I get only the Wages that starts with the number 2. I have tried many options, but none of then have worked for me. I tried this formula but it didnt work either, Wages LIKE '2%'
I got an error saying it cant be done because is not character formatted. Any ideas?
Assuming this is EG, which it sounds like you should post it in EG Forum
This would be a two step process in my opinion, 1, convert to character and then check if the first character is a 2. You can easily nest these functions though.
LinLin's code above could also be used in your query, but there are many other options, since it generates a conversion note.
substr(left(put(n, 8.)), 1, 1)='2'
example:
data have;
input n;
cards;
20
30
;
data want;
set have;
if first(left(n))='2';
proc print;run;
Assuming this is EG, which it sounds like you should post it in EG Forum
This would be a two step process in my opinion, 1, convert to character and then check if the first character is a 2. You can easily nest these functions though.
LinLin's code above could also be used in your query, but there are many other options, since it generates a conversion note.
substr(left(put(n, 8.)), 1, 1)='2'
Or to make it short while avoiding notes in the log:
first(cats(n))='2'
or even shorter
cats(n)=:'2'
Edit: Oops sorry I didn't see this was old. Why was it in the front page?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: