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.
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;
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?
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;
Forget the question for a second.
Show us the two libname statements to the folders you need.
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
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;
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
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 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.