DATA Step, Macro, Functions and more

Accepted Solution

Infile Statment Help

Reply
Highlighted
Respected Advisor
Posts: 4,566

Re: Infile Statment Help

[ Edited ]

@Ahsan

The following code will write mapped drives to the log as seen by the SAS server. That's what's available to your SAS program.

filename diskinfo DRIVEMAP;
data _null_;
  infile diskinfo;
  input;
  put _infile_;
run;

http://support.sas.com/kb/24/818.html 

Contributor
Posts: 60

Re: Infile Statment Help

I try the copy path technique it didn't work I saved in the other path still not working that's strange.
Contributor
Posts: 60

Re: Infile Statment Help

the sas file in on server and we using import function and it produces this code. In this code infile statement is used if I like to input new file using this code and change the file name in the infile statement can I do this.

 

DATA WORK.OIA_GL_DET_LEDGER_DAPG67_EXCEL;

LENGTH

'EFF DTE'n 8

COMP 8

ACCOUNT 8

'ACCOUNT DESCRIPTION'n $ 24

CENTER 8

'DOC ID'n $ 12

LINE 8

'INV.DTE'n 8

ENTY $ 4

'TXN DESCRIPTION'n $ 21

'CHECK NUM'n 8

'CTRL D GRP'n 8

AMOUNT 8

SY $ 2

'VENDOR N.'n 8

GR 8

BUYR $ 4

'PO NUMBER'n $ 10 ;

FORMAT

'EFF DTE'n MMDDYY10.

COMP BEST4.

ACCOUNT BEST6.

'ACCOUNT DESCRIPTION'n $CHAR24.

CENTER BEST8.

'DOC ID'n $CHAR12.

LINE BEST4.

'INV.DTE'n MMDDYY10.

ENTY $CHAR4.

'TXN DESCRIPTION'n $CHAR21.

'CHECK NUM'n BEST11.

'CTRL D GRP'n BEST11.

AMOUNT BEST5.

SY $CHAR2.

'VENDOR N.'n BEST9.

GR BEST2.

BUYR $CHAR4.

'PO NUMBER'n $CHAR10. ;

INFORMAT

'EFF DTE'n MMDDYY10.

COMP BEST4.

ACCOUNT BEST6.

'ACCOUNT DESCRIPTION'n $CHAR24.

CENTER BEST8.

'DOC ID'n $CHAR12.

LINE BEST4.

'INV.DTE'n MMDDYY10.

ENTY $CHAR4.

'TXN DESCRIPTION'n $CHAR21.

'CHECK NUM'n BEST11.

'CTRL D GRP'n BEST11.

AMOUNT BEST5.

SY $CHAR2.

'VENDOR N.'n BEST9.

GR BEST2.

BUYR $CHAR4.

'PO NUMBER'n $CHAR10. ;

INFILE '/sas/saswork/SAS_work309F00009EC8_trvlapp1981/#LN00014'

LRECL=170

ENCODING="LATIN1"

TERMSTR=CRLF

DLM='7F'x

MISSOVER

DSD ;

INPUT

'EFF DTE'n : ?? MMDDYY8.

COMP : ?? BEST4.

ACCOUNT : ?? BEST6.

'ACCOUNT DESCRIPTION'n : $CHAR24.

CENTER : ?? BEST8.

'DOC ID'n : $CHAR12.

LINE : ?? BEST4.

'INV.DTE'n : ?? MMDDYY8.

ENTY : $CHAR4.

'TXN DESCRIPTION'n : $CHAR21.

'CHECK NUM'n : ?? BEST11.

'CTRL D GRP'n : ?? BEST11.

AMOUNT : ?? COMMA5.

SY : $CHAR2.

'VENDOR N.'n : ?? BEST9.

GR : ?? BEST2.

BUYR : $CHAR4.

'PO NUMBER'n : $CHAR10. ;

RUN;

 

 

Super User
Super User
Posts: 7,860

Re: Infile Statment Help

In general YES. If you have a working data step, even one as ugly as the thing that EG generated for you, you can point it at a file with a similar structure and use it to create a dataset.

 

But the problem is that your current code was most likely created o read a text file that Enterprise Guide generated from a Excel spreadsheet.  So if you have another Excel SpreadSheet you would need to perform the same types of modifications that EG did to create a similar delimited text file that the SAS dataset expects to read.  There is no way that I know to perform just the Excel to text file step of EG.  Certainly you cannot do it the non-windows server where your SAS session is running.

Contributor
Posts: 60

Re: Infile Statment Help

Tom is a txt file file the data set name is excel but it's a txt file format.
Solution
‎01-10-2018 04:32 PM
Community Manager
Posts: 3,362

Re: Infile Statment Help

The one other caveat: Did EG transform your file at all before it uploaded it?  

 

Background info in this article -- why it happens and how to make EG skip that step, which would be important for repeatability of your program.

Contributor
Posts: 60

Re: Infile Statment Help

Posted in reply to ChrisHemedinger
Thank you it works perfectly I appreciated all the help
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 21 replies
  • 396 views
  • 3 likes
  • 6 in conversation