I have attached a screenshot of the question. Please help me figure this out, i'm very lost.
1. read the source data using 2 data steps
data table1;
infile datalines ..
input ...
datalines;
your data
;
run;
2. Concatenate
Either use Proc Append or a third data step
3. Interleaving
First sort your data sets by Flavor
Here the detailed docu with code examples of how you can combine SAS data sets
I'm not sure that I understand the term "cake brand" but you can check next code:
data Duncan;
length flavor $15;
infile datalines dlm=',' truncover;
input flavor $ height;
datalines;
Devil's food ,39
Devil's food ,36.5
White ,30.5
White ,34.5
Yellow , 37.0
Yellow , 35.0
run;
data Betty;
length flavor $15;
infile datalines dlm=',' truncover;
input flavor $ height;
datalines;
Devil's food ,35.5
Devil's food ,36.0
White ,35.5
White ,37.5
Yellow , 32.5
Yellow , 32.5
run;
data all;
set duncan
betty indsname=_dsn;
by flavor;
brand = scan(_dsn,2,'.');
run;
title 'Duncan & Betty results';
proc print data=all;
var brand flavor height;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.