Hello All,
Good evening.
I am working on a code in which I have to reproduce all observations in loop (max iteration of loop will be decided by number of observations) in such a way that each variable value is reproduced against all values and so on.
have
Apple
Orange
Banana
Want
Apple, Apple
Apple, Orange
Apple, Banana
Orange, Apple
Orange, Orange
Orange, Banana
Banana,Apple
Banana, Orange
Banana, Banana
The number of observations in "have" list can change each time.
Please help!
This is an easy task for SQL:
proc sql;
create table want as select a.fruit as v1, b.fruit as v2
from have a, have b;
quit;
I'm guessing at the variable names to use, since you didn't supply any in your question.
I think I got the syntax right, but it might need a little tweak.
This is an easy task for SQL:
proc sql;
create table want as select a.fruit as v1, b.fruit as v2
from have a, have b;
quit;
I'm guessing at the variable names to use, since you didn't supply any in your question.
I think I got the syntax right, but it might need a little tweak.
You approach was also what came to mind for me. I can see DBA's having a huge issue with a Cartesian join, but for small tables that certainty works!
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.