HI there,
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:
Data etllib.TEMPSDelivered_NonDeliveredFact;
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.;
file outdir(&Read&fname);
put _INFILE_;
run;
proc append base=etllib.Delivered_NonDeliv data=etllib.TEMPSDelivered_NonDeliveredFact;
run;
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...
Thank you.
Best Regards
LiangCk
Hi bruno,
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.
Best Regards:
Liang Ck
Liang
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.
Bruno
Hi Bruno,
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...
Thanks again..
Liang Ck
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.