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

You really need tor review your SET statement dataset calls 

 

Play with some values to see distinct values 

 


proc sql;

select distinct rand_group

from have;

quit;



/*or a */

proc freq data=have;

tables rand_group;

run;

 

 

The above will give you an idea what's in your dataset to eventually know what to expect

GS2
Obsidian | Level 7 GS2
Obsidian | Level 7
This is the output from the proc freq of the data set I am using in the set statement

rand_group Frequency Percent Frequency Percent
Treatment A  27  50.94  27  50.94
Treatment B  26  49.06   53  100.00

Frequency Missing = 477

 

novinosrin
Tourmaline | Level 20

Ok so I suppose you got the same for 

Proc sql;

select distinct rand_group

from have

quit;

 

as well.

 

In that case , you are definitely not referencing the correct dataset that picks yes/no from mars or moon lol 

GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Proc sql;

select distinct rand_group

from SPIES.SPIES_ANALYSIS_DEMOS

quit;

 

proc freq data = SPIES.SPIES_ANALYSIS_DEMOS;

table rand_group;

run;

 

Both show only treatment group a and b

 

data SPIES_ANALYSIS_DEMOS2;
do _n_=1 by 1 until(last.study_id);
set SPIES.SPIES_ANALYSIS_DEMOS;
by study_id;
if _n_=2 then _temp=Rand_group;
end;
do _n_=1 to _n_;
set SPIES.SPIES_ANALYSIS_DEMOS;
by study_id;
if _n_=1 then Rand_group=_temp;
output;
end;
drop _:;
run;

 

I am setting it to the same data set that is showing only treatment a and b 

novinosrin
Tourmaline | Level 20

And is it still show YES, NO? 

 

If it does, can you check upstream thoroughly. And if it is not confidential that would violate security/compliance, can you attach your sas dataset here? So I can work on it

GS2
Obsidian | Level 7 GS2
Obsidian | Level 7

Still has a yes/no. I cannot release my data set. Thank you for the help but I am going to use an if/then statement and manually fill in the data. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 2824 views
  • 1 like
  • 2 in conversation