Help using Base SAS procedures

Why cannot read this file?

Accepted Solution Solved
Reply
Super Contributor
Posts: 338
Accepted Solution

Why cannot read this file?

Hi Community,

I have run the proc freq for the attahced file and it produces output.

proc freq data=tt;

tables status_12;

run;

Question

When I tried the below subsetting, log says

NOTE: No rows were selected. And subsetted table is not created.

How come this happen? Could anyone please let me know.

data current;

set tt;

if status_12 ='CURRENT';

run;

proc sql;

select status_12

from tt

where status_12 = 'CURRENT';

quit;

Thanks

Mirisage

Attachment

Accepted Solutions
Solution
‎06-20-2012 02:19 PM
Super Contributor
Posts: 349

Re: Why cannot read this file?

Hi,

Try this..

data current;

set tt;

if status_12 ='  CURRENT';

run;

Thanks,

Shiva

View solution in original post


All Replies
Solution
‎06-20-2012 02:19 PM
Super Contributor
Posts: 349

Re: Why cannot read this file?

Hi,

Try this..

data current;

set tt;

if status_12 ='  CURRENT';

run;

Thanks,

Shiva

Super Contributor
Posts: 338

Re: Why cannot read this file?

Hi Shiva,

Yes, it worked. Thanks a lot.

Could you please let me know how your code worked while my same code not worked.

How did you decide to leave two spaces in front of  '  CURRENT';

Please let me know. Thanks

Super User
Super User
Posts: 7,035

Re: Why cannot read this file?

Here is one way to see what is really in your character data.

data _null_;

  set x.tt;

  put (_character_) (= $quote. /) /;

run;

Output on the LOG:

STATUS_12="  CURRENT"

STATUS_11="  CURRENT"

STATUS_10="  CURRENT"

STATUS_9="  CURRENT"

STATUS_8="  CURRENT"

STATUS_7="  CURRENT"

STATUS_6="  CURRENT"

STATUS_5="  CURRENT"

STATUS_4="  CURRENT"

STATUS_3="  CURRENT"

STATUS_2="  CURRENT"

STATUS_1="  CURRENT"

STATUS_0="  CURRENT"

STATUS_12="  CURRENT"

STATUS_11="  CURRENT"

STATUS_10="  CURRENT"

STATUS_9="  CURRENT"

STATUS_8="  CURRENT"

STATUS_7="  CURRENT"

STATUS_6="  CURRENT"

STATUS_5="  CURRENT"

STATUS_4="  CURRENT"

STATUS_3="  CURRENT"

STATUS_2="  CURRENT"

STATUS_1="  CURRENT"

STATUS_0="  CURRENT"

STATUS_12="  CURRENT"

STATUS_11="  CURRENT"

STATUS_10="  CURRENT"

STATUS_9="  CURRENT"

STATUS_8="  CURRENT"

STATUS_7="  CURRENT"

STATUS_6="  CURRENT"

STATUS_5="  CURRENT"

STATUS_4="  CURRENT"

STATUS_3="  CURRENT"

STATUS_2="  CURRENT"

STATUS_1="  CURRENT"

STATUS_0="  CURRENT"

STATUS_12="  CURRENT"

STATUS_11="  CURRENT"

STATUS_10="  CURRENT"

STATUS_9="  CURRENT"

STATUS_8="  CURRENT"

STATUS_7="  CURRENT"

STATUS_6="  CURRENT"

STATUS_5="  CURRENT"

STATUS_4="  CURRENT"

STATUS_3="  CURRENT"

STATUS_2="  CURRENT"

STATUS_1="  CURRENT"

STATUS_0="  CURRENT"

STATUS_12="  CURRENT"

STATUS_11="  CURRENT"

STATUS_10="  CURRENT"

STATUS_9="  CURRENT"

STATUS_8="  CURRENT"

STATUS_7="  CURRENT"

STATUS_6="  CURRENT"

STATUS_5="  CURRENT"

STATUS_4="  CURRENT"

STATUS_3="  CURRENT"

STATUS_2="  CURRENT"

STATUS_1="  CURRENT"

STATUS_0="  CURRENT"

NOTE: There were 5 observations read from the data set X.TT.

Super Contributor
Posts: 338

Re: Why cannot read this file?

Hi Tom,

This is exactly what I wanted to know in my second "question".

Now I know how the 2 spaces were decided in "  CURRENT"

Thank you very much. I wanted to "click" "correct answer", but there was no such option left for me to "click".

Regards

Mirisage

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 216 views
  • 3 likes
  • 3 in conversation