From: Kulpreet Khanna on
On Feb 18, 12:28 pm, procconte...(a)GMAIL.COM (SAS_learner) wrote:
>  Hello all,
>
> I am trying to separate Base lesion measurements  from main dataset and
> trying to merge it back to get base measurements next to remaining ones. In
> the Base data set I have 86 and Remaining dataset has 110 but when merging
> back I am getting 93 obs. I tried Left and Right join but did not get what I
> am getting here is my Log
>
> 965  Data Lsld_base (Rename = (Lsstresn= Base_Lss Lsdtc = Base_date Lsdy =
> base_lsdy));
> 966    set Crtdir.Ls(Where = (Lscat = "TARGET LESION"  and Lstestcd ^=
> "LSLDSUM"  and Visitnum =
> 966!  10));
> 968  run;
>
> NOTE: There were 86 observations read from the data set CRTDIR.LS.
>       WHERE (Lscat='TARGET LESION') and (Lstestcd not = 'LSLDSUM') and
> (Visitnum=10);
> NOTE: The data set WORK.LSLD_BASE has 86 observations and 19 variables.
> NOTE: DATA statement used (Total process time):
>       real time           0.02 seconds
>       cpu time            0.03 seconds
>
> 973  Data Lsld_rem ;
> 974    set Crtdir.Ls(Where = (Lscat = "TARGET LESION"  and Lstestcd ^=
> "LSLDSUM"  and Visitnum
> 974! ^= 10));
> NOTE: Data file CRTDIR.LS.DATA is in a format that is native to another
> host, or the file
>       encoding does not match the session encoding. Cross Environment Data
> Access will be used,
>       which might require additional CPU resources and might reduce
> performance.
> 975      Keep Usubjid Lsspid Lsloc Lsstresn ;
> 976  run;
>
> NOTE: There were 110 observations read from the data set CRTDIR.LS.
>       WHERE (Lscat='TARGET LESION') and (Lstestcd not = 'LSLDSUM') and
> (Visitnum not = 10);
> NOTE: The data set WORK.LSLD_REM has 110 observations and 4 variables.
> NOTE: DATA statement used (Total process time):
>       real time           0.02 seconds
>       cpu time            0.03 seconds
>
> 982  Proc Sql ;
> 983    Create table Les_1 as
> 984  Select B.* , a.Base_Lss, base_lsdy,   Base_date
> 985  From  Lsld_Base as a  , Lsld_rem  as b
> 986  Where   a.Usubjid = b.Usubjid
> 987   and a.Lsspid = b.Lsspid
> 988   and a.lsloc = b.Lsloc ;
> NOTE: Table WORK.LES_1 created, with 93 rows and 7 columns.
> 989  Quit;
> NOTE: PROCEDURE SQL used (Total process time):
>       real time           0.02 seconds
>       cpu time            0.01 seconds

This is very much possible, since you are doing a common merge. Thr
might be subjects with no 10th visit.
From: montura on
I you need to see the absence, create an index of unique ID with a
visitID column - perform a left join to that.

missing values will indicate an absence in the second dataset.