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

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2336 views
  • 0 likes
  • 3 in conversation