BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
marianhabesland
Calcite | Level 5

I am supposed to use one DATA statement and 2 LIBNAME steps to copy the SAS data set in the ‘1 – Source’ folder named ‘ndi’ into the ‘2 – Tabulations’ folder as a data set named ‘Src_ndi’. I am confused exactly how to do this with these specific steps.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ShiroAmada
Lapis Lazuli | Level 10

libname source "/folders/myfolders/BIOS6680/Hypertension Study/1 - Data";

libname target "/folders/myfolders/BIOS6680/Hypertension Study/1 - Data/2 - Tabulations";

 

data target.SRC_NDI;

  set source.NDI.;

run;

View solution in original post

7 REPLIES 7
Reeza
Super User

I suspect this is homework, so I"m going to ask, what exactly is the question and which part specifically are you having difficulty with?

marianhabesland
Calcite | Level 5

This is the complete question:

Task:  Within the Hypertension Study, use the DATA step to copy the SAS data set in the ‘1 – Source’ folder named ‘ndi’ into the ‘2 – Tabulations’ folder as a data set named ‘Src_ndi’ (per the ‘Hypertension Study – Data Map.xlsx’ file).

 

Note:  Your code should include 2 LIBNAME statements and 1 DATA step.

 

I am struggling how I combine the LIBNAME statements and DATA steps to actually both copy and move the file

 

The specific locations of the folders I am trying to 

Trying to move file from:

/folders/myfolders/BIOS6680/Hypertension Study/1 - Data;

TO

/folders/myfolders/BIOS6680/Hypertension Study/1 - Data/2 - Tabulations;

 

Reeza
Super User

Forget the question for a second. 

Show us the two libname statements to the folders you need.

marianhabesland
Calcite | Level 5

These are the statements I initially tried, but am unsure if this is what I was supposed to do

LIBNAME Source /folders/myfolders/BIOS6680/Hypertension Study/1 - Data/1 - Source
LIBNAME Tabs /folders/myfolders/BIOS6680/Hypertension Study/1 - Data/2 - Tabulations

marianhabesland
Calcite | Level 5

EDIT

These are the statements I initially tried, but am unsure if this is what I was supposed to do

LIBNAME Source /folders/myfolders/BIOS6680/Hypertension Study/1 - Data/1 - Source;
LIBNAME Tabs /folders/myfolders/BIOS6680/Hypertension Study/1 - Data/2 - Tabulations;

Reeza
Super User

That's not correct. The paths need to be quoted. 

If you run the code I assume you're still getting errors. I need to sleep now but if you search on here re 'permanent sas data sets' you'll find lots of examples. 

 

Other good resources:

videos.sas.com -> how to section 

lexjansen.com -> search any topic for user written papers

here -> the Analytics U forum has a lot of beginner related questions and answers

SAS UE Help Centre 

 

ShiroAmada
Lapis Lazuli | Level 10

libname source "/folders/myfolders/BIOS6680/Hypertension Study/1 - Data";

libname target "/folders/myfolders/BIOS6680/Hypertension Study/1 - Data/2 - Tabulations";

 

data target.SRC_NDI;

  set source.NDI.;

run;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 7 replies
  • 3192 views
  • 0 likes
  • 3 in conversation