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

Hi everyone,

 

I'm a french machine learning student ans I would really like to use a NHANES dataset to perform linear regression with python, but as the data is made for SAS i want first to create the dataset thanks to SAS.

 

I'm using the free SAS Studio related to the SAS University Edition, I contacted NHANES to know the steps to follow in order to create the dataset. I did as it was indicated in their e-mails but I still have errors and as I'm totally new to SAS I can't figure out why I'm still struggling with creating the dataset.

 

Here is the link to the NHANES dataset, followed by the errors I got when I run the SAS code provided (after replacing filename with the location of the data downloaded and saved as .dat on my computer) :

 

https://wwwn.cdc.gov/nchs/nhanes/nhanes3/datafiles.aspx#core the first Household Adult File in the core data section is the dataset I want

 

and the errors and warings :

 

ERROR 180-322: Statement is not valid or it is used out of proper order.
 
Also have the following warnings :
 
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.WORK may be incomplete. When this step was stopped there were 0 observations and 1238 variables.
WARNING: Data set WORK.WORK was not replaced because this step was interrupted. 
 
(there was a part in french in the last warning that I translated to english myself)
 
Help would be much appreciated
 
Thanks a lot,
 
Best regards
 
Geoffrey Laforest
 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
SAS Super FREQ

When you SAS is running in the operating system installed on your PC, any file you can find via the Explorer in SAS Studio are also avialable to your SAS Compute Server (the SAS installed on your machine):

SASJedi_0-1629114738635.png

 

With SAS University Edition(UE), your SAS is running in a Linux virtual machine. This works just as if your Linux SAS Compute Server was installed on completely different hardware.

SASJedi_1-1629115194102.png

The Virtual machine has virtual disks, but you don't have write access to those. Your computer has a hard drive, but the SAS University Edition virtual machine knows nothing about that. When you set up SAS University Edition, you were given instructions on setting up a shared folder - a location where both the Virtual Machine and your Windows computer could read and write. Because SAS University Edition is deprecated, I don't have access to it, so I can't give you the exact path, but you need to put the .dat file in there and use the Linux path to point to the file.

 

Check out my Jedi SAS Tricks for SAS Users

View solution in original post

4 REPLIES 4
SASJedi
SAS Super FREQ

The SAS code provided is incomplete and includes non-printable characters. To create this dataset:

1. Right-click the link for the .DAT file and choose "Save link as" to save the adult.dat file to your hard drive. I saved mine to the C:\temp directory: 

SASJedi_0-1628785992136.png

2. Right-click the SAS Code link and save the adult.sas program file, too.

3. Open the adult.sas program file in SAS and make the following changes:

The first part of the program looks like this:

 

FILENAME ADULT "D:\Questionnaire\DAT\ADULT.DAT" LRECL=3348;
*** LRECL includes 2 positions for CRLF, assuming use of PC SAS;

DATA WORK;

 

 

In the first line, change the FILENAME statement to point to the actual location of the adult.dat file. And wanted my dataset to be named adult instead of work, so I also changed the name of the output file in the DATA statement: 

 

FILENAME ADULT "C:\temp\ADULT.DAT" LRECL=3348;
*** LRECL includes 2 positions for CRLF, assuming use of PC SAS; DATA WORK.ADULT;

Now, use go to the very end of the program file and you'll see something like this:

 

 

        HAZNOK5R = "Number of BP's used for average K5";



The little box you see is a non-printable character.  Delete it and replace it with a RUN; statement so it now looks like this:

 

        HAZNOK5R = "Number of BP's used for average K5";
run;

Save the modified SAS program, then run it. It should work fine now.  

 

 

 

Check out my Jedi SAS Tricks for SAS Users
geogeo14000
Fluorite | Level 6

Thank you very much for your answer and sorry for mine being late.

 

Well it's a bit strange. I replaced the strange character by run; If the path is the path to the SAS code file, there is no error but I have an empty array with around 1800 columns/variables and no row.

 

Now if I replace the path by the path to adult.dat that I saved as a link as you showed me, I have this error : 

ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/D:\Divers\Dossiers et Thèmes\Maths
Informatique\Informatique\IA\IA_projet\MyOwnModels\LogisticRegression\adult.dat.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ADULT may be incomplete. When this step was stopped there were 0 observations and 1238 variables.
WARNING: Data set WORK.ADULT was not replaced because cette étape a été interrompue.
 
In the path, I tried both upper case ADULT.DAT and lowercase adult.dat (my file is saved in lower case) and none of these is working. I thought it might be the withespace in the file path causing the problem, but when I use it with the sas Code file name instead of adult.dat there is no such error so I'm really lost.
 
I joined the printing of the physical location of my file and of the errors.
 
Thanks again,
 
Geoffrey. 
SASJedi
SAS Super FREQ

When you SAS is running in the operating system installed on your PC, any file you can find via the Explorer in SAS Studio are also avialable to your SAS Compute Server (the SAS installed on your machine):

SASJedi_0-1629114738635.png

 

With SAS University Edition(UE), your SAS is running in a Linux virtual machine. This works just as if your Linux SAS Compute Server was installed on completely different hardware.

SASJedi_1-1629115194102.png

The Virtual machine has virtual disks, but you don't have write access to those. Your computer has a hard drive, but the SAS University Edition virtual machine knows nothing about that. When you set up SAS University Edition, you were given instructions on setting up a shared folder - a location where both the Virtual Machine and your Windows computer could read and write. Because SAS University Edition is deprecated, I don't have access to it, so I can't give you the exact path, but you need to put the .dat file in there and use the Linux path to point to the file.

 

Check out my Jedi SAS Tricks for SAS Users
geogeo14000
Fluorite | Level 6

Ok thank you so much for the detailed explanations and the pictures, it helped a lot. I'd try to find the path and solve the problem. 

 

Have a nice day,

 

Yours sincerely,

 

Geoffrey

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 1081 views
  • 2 likes
  • 2 in conversation