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
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
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
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
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
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.
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!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: