HI,
I am trying a simple step to see if both variables do not match then falg it but i can see both variables the same and have a flag.
Attached test data and code used
data nd; set test; format _all_; informat _all_; run; data ing; set nd; if start_time ne time2 then flag=1; run;
Seems to work fine?
In what row do you see the problem?
data WORK.TENT;
infile datalines dsd truncover;
input SUBJECT:$5. START_TIME:32. TIME2:32.;
datalines4;
N1001,47460,47460
N1001,47460,47460
N1001,45480,45240
N1001,45480,45240
N1002,44880,44880
N1002,44880,44880
N1002,35700,35700
N1002,35700,35700
N1003,54300,54300
N1003,54300,54300
N1008,0,41880
N1008,0,41880
N1008,47400,47400
N1008,47400,47400
N1010,33300,33300
N1010,33300,33300
N1010,33780,33780
N1010,33780,33780
N1011,33660,33660
N1011,33660,33660
N1011,33180,33180
N1011,33180,44760
N1013,31920,31920
N1013,31920,31920
N1013,29760,29760
N1013,29760,29760
N1017,41700,41700
N1017,41700,41700
N1017,42600,42600
N1017,42600,42600
N1018,59100,59100
N1018,59100,59100
N1018,54900,54900
N1018,54900,54900
N1020,49500,49500
N1020,49500,49500
N1020,53400,53400
N1020,53400,53400
N1022,37920,37920
N1022,37920,37920
N1022,46380,46380
N1022,46380,46380
N1024,49200,49200
N1024,49200,49200
N1024,47700,49500
N1024,47700,49500
N1025,51000,51000
N1025,51000,51000
N1026,48480,48480
N1026,48480,48480
;;;;
data nd;
set TENT;
format _all_;
informat _all_;
run;
data ing;
set nd;
if start_time ne time2 then flag=1;
run;
I get for a lot of them for example first 2 rows it flags as 1 where as it should be blank.
Running
proc print data=ing(obs=2);
run;
on the exact code that I posted gives
as desired?
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 25. 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.