BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Mirisage
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
shivas
Pyrite | Level 9

Hi,

Try this..

data current;

set tt;

if status_12 ='  CURRENT';

run;

Thanks,

Shiva

View solution in original post

4 REPLIES 4
shivas
Pyrite | Level 9

Hi,

Try this..

data current;

set tt;

if status_12 ='  CURRENT';

run;

Thanks,

Shiva

Mirisage
Obsidian | Level 7

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

Tom
Super User Tom
Super User

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.

Mirisage
Obsidian | Level 7

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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