Data clinical;
input center$ trail$ sub adsub;
cards;
appolo phase1 67 12
nims phase1 78 14
care phase1 34 10
appolo phase2 267 22
nims phase2 178 14
care phase2 234 40
;
run;
How to put all appolo value in DSN1,
put all nims value in DSN2,
put all care value in DSN3 by automation
Combine IF-statements with explicit OUTPUT statements.
Combine IF-statements with explicit OUTPUT statements.
Hello,
How to create multiple DSN according to different variables.
Please try to be more specific about your requirement.
I have merged both posts with the same title. If both are about different problems, please use more meaningful titles next time.
@BrahmanandaRao wrote:
Data clinical;
input center$ trail$ sub adsub;
cards;
appolo phase1 67 12
nims phase1 78 14
care phase1 34 10
appolo phase2 267 22
nims phase2 178 14
care phase2 234 40
;
run;
data appolo nims care;
set clinical;
if center ='appolo' then output appolo ;
if center ='nims' then output nims ;
if center ='care' then output care ;
run;
Consider using a data step SELECT Statement instead of multiple IFs.
Please show us the "big picture". This looks like a XY Problem
@Brijesh4sas wrote:
Thank you but i need to automate it.
Thank you, but we need to UNDERSTAND what you are trying to do. For us to understand, you have to explain, which usually means you have to be generous with information, and provide additional information that we ask for, rather than what you have done so far which is to provide so few words that we don't understand. Please start with the answer to @Kurt_Bremser 's question and explain what you are trying to do.
We're trying to help you, but you have to help us too.
Splitting datasets is VERY rarely needed. I guess you want to do this for reporting or data export, and for this there are better methods. Please give us the "big picture".
@Brijesh4sas wrote:
data appolo nims care;
set clinical;
if center ='appolo' then output appolo ;
if center ='nims' then output nims ;
if center ='care' then output care ;
run;
I want to automate this
This post is perfectly useless, as does not provide any additional information.
What for do you think that you need the split datasets?
Data clinical;
input center$ trail$ sub adsub;
cards;
appolo phase1 67 12
nims phase1 78 14
care phase1 34 10
appolo phase2 267 22
nims phase2 178 14
care phase2 234 40
;
run;
i want to create DSN based on var=center
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.