I am struggling to combine datasets with unequal observations in SAS and no common variables between them.
Example: I have a dataset A and Dataset B and will be needing data set c which should look something like follows. Is there any I could do this? When there are no common variables in dataset A and B and not having equal observations in those datasets.
Data set A: Dataset B Dataset C
ID NAME CODE begin end ID Name Code begin end
1 X 123 120 130 1 x 123 120 30
2 Y 125 500 600 2 y 125 500 600
3 Z 567 3 z 567 120 30
4 A 783 4 A 783 500 600
Thanks very much!
You're right I want to repeat the records until the end. I have 30000 variables in dataset A and 32 observations in dataset B. So I want a dataset C with all the variables in dataset A and repeats of all the 32 variables in dataset B till the end.
Not really any type of merge. Looks like you want to cycle through the observations in B.
data want; set a; p=1+mod(_n_-1,nobs); set b point=p nobs=nobs; run;
What happens if A has fewer observations than B? What do want to do then? Would you want to do the same type of cycle through A?
data want; if _n_ > max(nobs1,nobs2) then stop; p1=1+mod(_n_-1,nobs1); p2=1+mod(_n_-1,nobs2); set a point=p1 nobs=nobs1; set b point=p2 nobs=nobs2; run;
I really appreciate your help with the previous question. I've got another problem and would like to use the help and advice of the SAS experts here.
I have multiple CSV data files with the same set of variables in every raw data file (also all the files are present in the same directory). I would like to import all of them once and create a new SAS.
Thanks for all your help in Advance!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.