BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Brijesh4sas
Fluorite | Level 6

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 

 

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

Combine IF-statements with explicit OUTPUT statements.

Data never sleeps

View solution in original post

17 REPLIES 17
LinusH
Tourmaline | Level 20

Combine IF-statements with explicit OUTPUT statements.

Data never sleeps
Brijesh4sas
Fluorite | Level 6

Hello,

How to create multiple DSN according to different variables.

LinusH
Tourmaline | Level 20

Please try to be more specific about your requirement.

Data never sleeps
andreas_lds
Jade | Level 19

I have merged both posts with the same title. If both are about different problems, please use more meaningful titles next time.

BrahmanandaRao
Lapis Lazuli | Level 10
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;
Kurt_Bremser
Super User

@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.

Brijesh4sas
Fluorite | Level 6
Thank you but i need to automate it.
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
Kurt_Bremser
Super User

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
Fluorite | Level 6
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
Kurt_Bremser
Super User

@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?

Brijesh4sas
Fluorite | Level 6
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
Brijesh4sas
Fluorite | Level 6

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 1672 views
  • 2 likes
  • 6 in conversation