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

Is there a way to upload XPORT files from Internet website like NHANES website directly to an ODA folder?Of course, I can download it to my computer and hen upload it to ODA folder but that is probably not what I want to do. Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
hhinohar
Quartz | Level 8

It looks like the url assigned is pointing to a starting page of cdc.

https://wwwn.cdc.gov/nchs/nhanes/search/datapage.aspx?Component=Laboratory&CycleBeginYear=2017

 

Correct url is a one like below.
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/ALB_CR_J.XPT

 

Below is a program I used for researching proc http.

 

filename resp "/home/xxxxxx/cportout/ALB_CR_J.XPT";

proc http url='https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/ALB_CR_J.XPT' 
		method="GET" out=resp;
run;
*cport file name;
libname libref1 xport '/home/u1878840/cportout/ALB_CR_J.XPT';
libname target '/home/xxxxxx/target';

View solution in original post

3 REPLIES 3
hhinohar
Quartz | Level 8

proc http might help.

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=proc&docsetTarget=p1dxmry...

 

filename resp "<folder_where_you_want_to_download_xpt_file>";

proc http url='<xpt-url>' 
		method="GET" out=resp;
run;
RBJ
Fluorite | Level 6 RBJ
Fluorite | Level 6
NO, it did not after libname statement. The uploaded file was not recognised as a SAS data.Here is my program:filename resp "/folders/myfolders/sasdata/CMV_J.XPT";proc http url='https://wwwn.cdc.gov/nchs/nhanes/search/datapage.aspx?Component=Laboratory&CycleBeginYear=2017' meth..." out=resp;run;libname xp xport '/folders/myfolders/sasdata/CMV_J.XPT';proc copy in=xp out=work;run;proc contents; run;
And here is the LOG
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 filename resp "/folders/myfolders/sasdata/CMV_J.XPT"; 74 proc http url='https://wwwn.cdc.gov/nchs/nhanes/search/datapage.aspx?Component=Laboratory&CycleBeginYear=2017' 75 method="GET" out=resp; 76 run; NOTE: PROCEDURE HTTP used (Total process time): real time 1.46 seconds cpu time 0.15 seconds 77 libname xp xport '/folders/myfolders/sasdata/CMV_J.XPT'; NOTE: Libref XP was successfully assigned as follows: Engine: XPORT Physical Name: /folders/myfolders/sasdata/CMV_J.XPT 78 proc copy in=xp out=work; 79 run; NOTE: Input library XP is sequential. ERROR: File XP.ALL. is not a SAS data set. NOTE: Statements not processed because of errors noted above. NOTE: PROCEDURE COPY used (Total process time): real time 0.00 seconds cpu time 0.01 seconds NOTE: The SAS System stopped processing this step because of errors. 80 proc contents; run; ERROR: File WORK.VERSION_1606509115215.DATA does not exist. NOTE: Statements not processed because of errors noted above.
hhinohar
Quartz | Level 8

It looks like the url assigned is pointing to a starting page of cdc.

https://wwwn.cdc.gov/nchs/nhanes/search/datapage.aspx?Component=Laboratory&CycleBeginYear=2017

 

Correct url is a one like below.
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/ALB_CR_J.XPT

 

Below is a program I used for researching proc http.

 

filename resp "/home/xxxxxx/cportout/ALB_CR_J.XPT";

proc http url='https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/ALB_CR_J.XPT' 
		method="GET" out=resp;
run;
*cport file name;
libname libref1 xport '/home/u1878840/cportout/ALB_CR_J.XPT';
libname target '/home/xxxxxx/target';

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3 replies
  • 1322 views
  • 1 like
  • 2 in conversation