So this is my coding:
data apple.import;
input App $ Size $ Price $ Rating $ Genres $;
datalines;
PAC-MAN_Premium 100788224 3.99 4 Games
Evernote_-_stay_organized 158578688 0 4 Productivity
run;
data google.import;
input App $ Size $ Price $ Rating $ Genres $;
datalines;
Photo_Editor_&_Candy_Camera_&_Grid_&_ScrapBook 19M 0 4.1 Art & Design
Sketch_-_Draw_&_Paint 25M 0 4.5 Art & Design
run;
data work;
merge apple.import google.import;
run;
proc print data=work;
run;
proc sort data= apple.import;
by App;
run;
proc sort data= google.import;
by App;
run;
but somehow my Apple and Google data sets aren't merging, showing only the result for Google.
Oh and I used this youtube video to help me : https://www.youtube.com/watch?v=-xqcH5pKhz8
In a similar situation ( having same variables and in same order), use PROC APPEND as:
proc append base = apple data = google;
run;
I have not used the LIBREF here.
Lets start with your first data-step:
data apple.import;
input App $ Size $ Price $ Rating $ Genres $;
datalines;
PAC-MAN_Premium 100788224 3.99 4 Games
Evernote_-_stay_organized 158578688 0 4 Productivity
run;
Are you sure about having a library called "apple"? Same issue with the second data-step.
In the title you are talking about appending datasets, but you are merging them. If you want to append both datasets, either use proc append or use the set-statement:
data combined;
set apple_import google_import;
run;
Please post the whole log of these steps. Use the {i} button to post that log.
We will then be able to take care of every single problem (as I suspect there are quite many), one by one.
MERGE has a specific meaning in SAS and I suspect you are conceptually using the word merge in a different meaning.
Here is an example of a MERGE of two data sets in SAS with no common variables so you can see the result:
data work.one; input x y; datalines; 1 2 3 4 6 6 ; data work.two; input w z; datalines; 33 44 55 66 ; /* no common variables*/ data work.merge1; merge work.one work.two; run;
MERGE in SAS means to align rows side by side. If there are common values then the values from one data set will appear
data work.three; input x z; datalines; 99 88 88 99 ; /* common variable*/ data work.merge2; merge work.one work.three; run;
Notice that the values of X in the work.merge2 data set for the first two rows are the X values from work.three.
Your merge meant that since you have the same variables in both sets that most likely you only see the "google" data.
What you want apparently is to STACK records from one set above the other. That is done in a data step with the SET statement. This shows what SET will do with data with no common variables and once common variable.
data work.set1; set work.one work.two; run; /* or with one common variable*/ data work.set2; set work.one work.three; run;
I suspect you're going to have some issues about lengths of common variables though.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.