Hello - thanks in advance for your time. I have dataset1 with 100+ variables and dataset2 with 100+ variables. Some of the variables match across the two datasets. I'm looking for a dataset3 that is the sum of the matching variables but also includes the unique variables from each dataset. I understand this is a relatively simple task by renaming the variables, merging the datasets and summing the like variables manually. However I'm looking to remove any manual processes from this program as I receive this data often and these manual steps are driving me crazy! Additionally, the variable naming conventions do not follow any sequence, i.e., x1 - xn. For example: data have1;
input geo time
web_wib_aln
web_wib_ccd
web_wib_dch
web_wib_dsv
web_wib_efs
web_wib_hel
web_wib_iau;
datalines;
501 209 0 0 1 2 3 4 5
501 210 0 0 1 2 3 4 5
501 211 0 0 1 2 3 4 5
;
RUN;
data have2;
input geo time
web_wib_ccd
web_wib_dch
web_wib_dsv
web_wib_ilh
web_wib_inv
web_wib_mtg
web_wib_onl;
datalines;
501 209 6 7 8 9 10 11 12
501 210 6 7 8 9 10 11 12
501 211 6 7 8 9 10 11 12
;
RUN;
The dataset I'm looking for:
data want;
input geo time
web_wib_ccd
web_wib_dch
web_wib_dsv
web_wib_aln
web_wib_efs
web_wib_hel
web_wib_iau
web_wib_ilh
web_wib_inv
web_wib_mtg
web_wib_onl;
datalines;
501 209 11 8 10 1 3 4 5 9 10 11 12
501 210 9 8 10 1 3 4 5 9 10 11 12
501 211 10 8 10 1 3 4 5 9 10 11 12
;
run; Again, thanks for your time and input!
... View more