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

Hello. 

I am trying to download a file from the Census.gov site and export it to my desktop.  The log shows that it reads the file and list the record count - but the file does not export out to my folder location.

 

Here is what I have for code.:

  

filename ifile ftp "de00014_uf1.zip" host='ftp2.census.gov' user='anonymous' 
    pass='myemail@corp.com' cd="/census_2000/datasets/Summary_File_1/Delaware/" 
    lrecl=1 recfm=f;
filename ofile 'C:\Users\myname\Desktop\de00014_uf1.zip' recfm=f lrecl=1;

data _null_;
    infile ifile;
    file ofile;
    input;
    put _infile_;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

It created the file that you asked it to create, but that is NOT a file on the H: drive that your PC can see. It is instead a really strangely named file in the one of the folders where SAS was installed.

NOTE: The file 'H:\TobyF\Files\de00014_uf1.zip' is:
      Filename=/sas/config/Lev1/SASApp/H:\TobyF\Files\de00014_uf1.zip,
      Owner Name=tobyF,Group Name=sas,
      Access Permission=-rw-rw-r--,
      Last Modified=30May2017:14:26:55

You need to make sure to use a filename that the SAS server can see.  

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20

And the log...?

Your code doesn't look complete...?

Data never sleeps
tobyfarms
Fluorite | Level 6

Hello @LinusH @Reeza.

My log looks like:

 

1                                                         The SAS System                                08:03 Tuesday, May 30, 2017

 

1         ;*';*";*/;quit;run;

2         OPTIONS PAGENO=MIN;

3         %LET _CLIENTTASKLABEL='Request_Work';

4         %LET _CLIENTPROCESSFLOWNAME='Process Flow';

5         %LET _CLIENTPROJECTPATH='';

6         %LET _CLIENTPROJECTPATHHOST='';

7        %LET _CLIENTPROJECTNAME='';

8         %LET _SASPROGRAMFILE='H:\TobyF\REPORTING\SAS\Request_Work.sas';

9         %LET _SASPROGRAMFILEHOST='2UA54714WN';

10        

11         ODS _ALL_ CLOSE;

12         OPTIONS DEV=PNG;

13         GOPTIONS XPIXELS=0 YPIXELS=0;

14         FILENAME EGHTML TEMP;

15         ODS HTML(ID=EGHTML) FILE=EGHTML

16             ENCODING='utf-8'

17             STYLE=HtmlBlue

18             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")

19             NOGTITLE

20             NOGFOOTNOTE

21             GPATH=&sasworklocation

22         ;

NOTE: Writing HTML(EGHTML) Body file: EGHTML

23        

24         GOPTIONS ACCESSIBLE;

25        

26         filename ifile ftp "de00014_uf1.zip"

27                       host=/*'www2.census.gov' */'ftp2.census.gov'

28                       user='anonymous'

29                       pass=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

30                       cd = "/census_2000/datasets/Summary_File_1/Delaware/"

31                       lrecl=5

32                       recfm=f;

33         filename ofile 'H:\TobyF\Files\de00014_uf1.zip'

34                       recfm=f

35                       lrecl=5;

36        

37         data _null_; infile ifile; /*input; */file 'H:\TobyF\Files\de00014_uf1.zip'/*ofile*/; input; put _infile_; run;

 

NOTE: 220-   **WARNING**WARNING**WARNING**WARNING**WARNING****WARNING**WARNING**

NOTE: User anonymous has connected to FTP server on Host ftp2.census.gov .

NOTE: The infile IFILE is:

      Filename=de00014_uf1.zip,

      Pathname= "/census_2000/datasets/Summary_File_1/Delaware,

      Local Host Name=alpha,

      Local Host IP addr=138.39.27.115,

      Service Hostname Name=ftp2.census.gov,

      Service IP addr=148.129.75.35,Service Name=FTP,

      Service Portno=21,Lrecl=5,Recfm=Fixed

 

NOTE: The file 'H:\TobyF\Files\de00014_uf1.zip' is:

      Filename=/sas/config/Lev1/SASApp/H:\TobyF\Files\de00014_uf1.zip,

      Owner Name=tobyF,Group Name=sas,

      Access Permission=-rw-rw-r--,

      Last Modified=30May2017:14:26:55

 

NOTE: 44860 records were read from the infile IFILE.

NOTE: 44860 records were written to the file 'H:\TobyF\Files\de00014_uf1.zip'.

2                                                         The SAS System                                08:03 Tuesday, May 30, 2017

 

      The minimum record length was 4.

      The maximum record length was 5.

NOTE: DATA statement used (Total process time):

      real time           0.56 seconds

      cpu time            0.03 seconds

     

 

38        

39        

40         data work.TEST;

41         infile 'H:\TobyF\Files\de00014_uf1.zip' truncover firstobs=30 obs=70;

42         input; put _infile_; ;

43        

44         run;

 

NOTE: The infile 'H:\TobyF\Files\de00014_uf1.zip' is:

      Filename=/sas/config/Lev1/SASApp/H:\TobyF\Files\de00014_uf1.zip,

      Owner Name=tobyF,Group Name=sas,

      Access Permission=-rw-rw-r--,

      Last Modified=30May2017:14:26:55,

      File Size (bytes)=269159

 

O­âZ

íjmík

__ÇœW

Ï6¯¶Ì

ö×bøu

ßR­\­

絿N\

Ë_oûÚ

.új3í

'Fßo¥

ï[òHW

_©â­í

  • µö›

«Î²+*

O”ŽÚ

vQ__k

Gå%_=

íB{Ùm

îµµý–

'>õݪ

9®n}_

ËÃðþ

/­Ý‚9

Q__im

Wn»Íu

Õ]rš»

_kwu×

»‹Omß

œwQ6k

Ýo»«5

ÙþŠ®Z

Û%›Õy

YÉûZ^

x+í*s

  • e¿•«

¬1¯Òw

3                                                         The SAS System                                08:03 Tuesday, May 30, 2017

 

me_~H

ã*cìO

}?±{µ

®‚æ–Ò

÷Íy_º

NOTE: 41 records were read from the infile 'H:\TobyF\Files\de00014_uf1.zip'.

      The minimum record length was 5.

      The maximum record length was 5.

NOTE: The data set WORK.TEST has 41 observations and 0 variables.

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.01 seconds

     

 

45        

46        

47         GOPTIONS NOACCESSIBLE;

48         %LET _CLIENTTASKLABEL=;

49         %LET _CLIENTPROCESSFLOWNAME=;

50         %LET _CLIENTPROJECTPATH=;

51         %LET _CLIENTPROJECTPATHHOST=;

52         %LET _CLIENTPROJECTNAME=;

53         %LET _SASPROGRAMFILE=;

54         %LET _SASPROGRAMFILEHOST=;

55        

56         ;*';*";*/;quit;run;

57         ODS _ALL_ CLOSE;

58        

59        

60         QUIT; RUN;

61        

 

Tom
Super User Tom
Super User

It created the file that you asked it to create, but that is NOT a file on the H: drive that your PC can see. It is instead a really strangely named file in the one of the folders where SAS was installed.

NOTE: The file 'H:\TobyF\Files\de00014_uf1.zip' is:
      Filename=/sas/config/Lev1/SASApp/H:\TobyF\Files\de00014_uf1.zip,
      Owner Name=tobyF,Group Name=sas,
      Access Permission=-rw-rw-r--,
      Last Modified=30May2017:14:26:55

You need to make sure to use a filename that the SAS server can see.  

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
  • 3 replies
  • 877 views
  • 0 likes
  • 3 in conversation