Hi:
The file truncated message has been linked to PROC IMPORT, as explained here:
http://support.sas.com/kb/5/492.html
I cannot duplicate your error message. I don't know how big your text field is, but I made a field larger than 200 and another field of $1000 and didn't have any issues. See the Log below.
[pre]
2652 data class;
2653 length long $35 temp really_long $275 r_r_long $1000;
2654 set sashelp.class;
2655 long = 'supercalifragilisticexpialidocious';
2656 temp = 'Twas brillig and the slithy toves '||
2657 'Did gyre and gimble in the wabe.x '||
2658 'All mimsy were the borogoroves, x '||
2659 'And the mome raths outgrabe. xx x ';
2660 really_long = catt(temp,temp);
2661 r_r_long = catt(temp,temp,long,temp,temp);
2662 run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.CLASS has 19 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
2663
2664 ods _all_ close;
2665 options linesize=256;
2666 ODS csv file="ESERCIZIO4.csv" type=csv;
NOTE: Writing CSV Body file: ESERCIZIO4.csv
2667
2668 PROC PRINT data=class NOobs;
2669 run;
NOTE: There were 19 observations read from the data set WORK.CLASS.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.15 seconds
cpu time 0.01 seconds
2670
2671 ODS csv close;
[/pre]
I suggest that you contact Tech Support on this issue.
Usually the rule is that you have to close the destination using the same destination reference you used when you opened the destination. I would recommend that you clean up your ODS invocation using one of the invocations, as shown:
[pre]
** 1) Use the tagset template alias method;
ods csv file='ex1.csv';
proc print data=sashelp.class;
run;
ods csv close;
** 2) Use the ODS MARKUP method;
ods markup type=csv file='ex2.csv';
proc print data=sashelp.class;
run;
ods markup close;
** 3) Use the ODS TAGSETS.xxx method;
ods tagsets.csv file='ex3.csv';
proc print data=sashelp.class;
run;
ods tagsets.csv close;
[/pre]
#1 works because ODS CSV is one of the "aliased" destinations that you can invoke by using the alias name -- for this invocation, the proper close is: ODS CSV CLOSE. Many ODS destinations have aliases. For example, ODS HTML is an alias for ODS TAGSETS.HTML4 and ODS MSOFFICE2K is an alias for ODS TAGSETS.MSOFFICE2K. Not all ODS MARKUP tagset templates have aliases, you can find the list of aliased destinations here:
http://support.sas.com/documentation/cdl/en/odsug/59523/HTML/default/a002217090.htm#a002588754
#2 works because you are invoking the ODS MARKUP destination with the TYPE= option -- for this invocation, the proper close is: ODS MARKUP CLOSE.
#3 works because you can always refer to the full name of the tagset template as a destination: ODS TAGSETS.CSV (or ODS TAGSETS.EXCELXP or ODS TAGSETS.MSOFFICE2K are other examples) -- the proper close for this invocation is ODS TAGSETS.CSV CLOSE.
If you use an improper close, it is possible (although not likely in this case), that the operating system won't properly close the file that's being created. I've seen this happen more often when creating multiple HTML or multiple RTF or multiple PDF files with improper closing syntax. You can always use ODS _ALL_ CLOSE; at the end of an ODS invocation to close ALL open destinations....no matter how you invoked them. Also, PROC PRINT is not an interactive procedure....it does not require a QUIT; as the final step boundary. You would need to put a QUIT after SAS/Graph syntax (not relevant in this case) or PROC SQL syntax (also not relevant in this case) or any interactive STAT procedure that uses QUIT and not RUN as the step boundary.
I suspect that you are getting prompted to open the CSV file because of a registry issue, such as that described here for RTF:
http://support.sas.com/kb/9/627.html
It doesn't make sense to me that you are getting this popup window if you're running this code as a batch job. Are you by any chance doing testing in SAS Enterprise Guide??? At any rate, I'd recommend working with Tech Support on this issue, too.
Also, just a terminology note...ODS CSV is not "technically" doing an EXPORT. When PROC EXPORT does an EXPORT, it uses a different mechanism to create the CSV or Excel file than ODS CSV uses. ODS CSV is creating an ASCII text file that is in CSV format. You can use PROC EXPORT only on a SAS dataset. However, you could ALSO send the results from PROC FREQ, PROC MEANS or PROC GLM to a CSV file using ODS CSV. When you use PROC PRINT with ODS CSV, you are sending the results of using PROC PRINT to an ASCII text file. ODS CSV doesn't care if you send PROC PRINT or PROC GLM results to a CSV file; on the other hand, PROC EXPORT would only work on a SAS dataset.
cynthia