10-06-2011 02:42 AM
First of all, thanks for reading this discussion.
i have a some code written that i want to append data that extracted from a series of csv file into one dataset.
what i have done is i "indirectly" append by temporaly store into a temp sas table then call proc append append into a detail table.
my code written like this:
infile indir(&fname) truncover delimiter=',' FIRSTOBS=2;
input CardCode:$15. CardName:$100. Block:$100. StreetNo:$100. Address:$100. ZipCode:$20. State:$100. Country:$100. fatherCard:$15. CardReceipt:$100. CardReceiptID:$15. Active:$1. Region:$200. Route_Code:$8.
Branch_Code:$8. Route_Day:$8. Delivery_Date:yymmdd10. ItemCode:$20. ItemName:$100. Quantity UOM:$20. RouteFreq:$100. Route_Sequence Route_Truck:$100. DeliveredStatus:$1. Reason:$100. LogTime:time. LogDate:yymmdd10.;
proc append base=etllib.Delivered_NonDeliv data=etllib.TEMPSDelivered_NonDeliveredFact;
Note:- "indir(&fname)" is a file path name that refer to a csv file.
- TEMPSDelivered_NonDeliveredFact is a temporaly table.
- Delivered_NonDeliv is a detail table.
PS: this process is in a nested loop.
Problem: am i just can direct append on the infile statment there instead of insert into TEMPSDelivered_NonDeliveredFact and call
proc append to done this job?
Please, help me..thank you everyone...
10-06-2011 03:36 AM
10-06-2011 03:36 AM
10-06-2011 05:36 AM
Thanks for replying my discussion.
First, replying your question.
Answer is YES, you are correct. I used it for creating a duplicate csv/file from the orginal file that i read. Something like duplication of a file or back up file.
indir() = is actualy a file directory and inside () is file name.
Beside, one question for sir, you mention using view. for my understanding, view is just create a temporary table in memory is it?
what i done is registering a "TEMP" table in a physical way.
Which one is much more better way? interm of performance and accurate?
Thank you and sorry for my poor english level.
10-06-2011 05:47 AM
When one is accessing a view (SQL or DATA Step), the data from the view is materialized and exists while reading from the view.
If you read the data from the view several times, it is usually better to make a SAS Data Set out of it.
10-06-2011 09:31 PM
Thank for your advice, i think i shall used back my method because this process related to dynamically read external file.
Static is much better...
Need further help from the community? Please ask a new question.