Cannot figure out how to import a cvs file. Appreciate any help.
My code:
options validvarname= any;
data Consumer;
proc import datafile="/courses/ddb976e5ba27fe300/NHANES 2013_2014/consumer.csv" out=Consumer dbms=csv replace;
getnames=no;
run;
proc contents data=Consumer;
run;
My errors:
ERROR: File WORK.CONSUMER.DATA does not exist.
ERROR: Import unsuccessful. See SAS Log for details.
My Task if needed:
The codebook, which shows the variable labels and formats, is available at:
https://wwwn.cdc.gov/Nchs/Nhanes/2013-2014/CBQ_H.htm
Import the consumer.csvdata into a temporary SAS data set called Consumer. The data values represent SEQN,CBD070,CBD090,CBD110,CBD120, and CBD130, respectively.
The variables in the Consumer data set should have permanently assigned variable labels.
How do I do that?
commenting your code means adding comments.
In SAS you can add a comment using *; or /* */
*this is my comment; proc means data=sashelp.class; class sex ; /*this is another comment*/ run;
It's considered good practice to comment your code. And I guarantee you'll save more time doing it because you'll find errors faster and avoid logical errors. And it's a good practice because it's hard to build in habits after you've already learned one way.
So comment every line in your code with what you think it is doing and you'll likely find your mistake. If not, past back with your code and comments and I'll tell you where the issue is.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.