BookmarkSubscribeRSS Feed
vraj1
Quartz | Level 8

I have the below code with conditions and when i run it it creates double observations.

I am creating a dataset which gives 1 if it satisfies a condition for each treatment group. But it resolves seperately and creates duplictes.

i use the below condition to have treatment wise but it duplicates like below in my datastep

%** Loop for each arm (to avoid transposing the data later) **;
%do k = 1 %to %sysfunc(countw(&ArmList., #)); %** Start for each ArmVar **;
if compress(&ArmVar.) = "%scan(&ArmList.,&k., #)" then do; %** if ArmVar condition **;

 and it is resolved to  code attached.

 

Can any one help me what i am doing wrong

 

 

4 REPLIES 4
FredrikE
Rhodochrosite | Level 12

Check subjid S1287, it will be outputted 3 times, the reason is that it fulfills these conditions:

 

if compress(actarm) = "BLINDED"

if SAFFL='Y'

if dsreas_num_BLINDED

 

All of these has an output statement, you have to check your conditions again if this is not the desired result 🙂

 

//Fredrik

vraj1
Quartz | Level 8

If it fulfills all conditions then it should be multiple. But what i get is multiple obs of subjids for almost most of them

FredrikE
Rhodochrosite | Level 12

I think you need to pick some of the obs you don't want to have multiple times and check the rules for them 🙂

Kurt_Bremser
Super User

@vraj1 wrote:

If it fulfills all conditions then it should be multiple. But what i get is multiple obs of subjids for almost most of them


Then they all fulfill multiple conditions. Maxim 3: Know your data.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 889 views
  • 1 like
  • 3 in conversation