After studying two days of SAS, SAS can finally obtain the file name and column name.
// Obtain the file column name
Libname da "C: \ test ";
Data ex;
Set da. QQ;
Run;
Proc transpose data = ex out = ex2;
VaR _ all _; // the table cannot be completely transposed before it is added. Some columns are always missing.
Run;
Proc print data = ex2;
Run;
// Obtain the file name in a folder
Filename indata pipe 'dir c: \ Tes/B ';
Data file_list;
Length fname $50 .;
Infile indata truncover;/* infile statement for file names */
Input fname $50.;/* read the file names from the directory */
Call symput ('num _ FILES ', _ n _);/* store the record number in a macro variable */
Run;
// Call vs.net
String [] sasdatatext = {
"FILENAME indata pipe 'dir c: \ Tes/B '; Data file_list ;",
"Length fname $50 .;",
"Infile indata truncover ;",
"Input fname $50 .;",
"Call symput ('num _ FILES ', _ n _);",
"Run ;",
"Proc print ;",
"Run ;"
};
System. array sasarray = sasdatatext;
Sasworkspace. explorageservice. submitlines (ref sasdatatext );
Const int Len = 100;
Wsas. languageservicecarriagecontrol [] CCS;
Wsas. languageservicelinetype [] linetype;
String [] logline;
Sasworkspace. Export ageservice. flushlistlines (Len, out CCS, out linetype, out logline );
We call language service to submit the SAS data step and process step and receive log and list output. For how to execute SQL statements, refer to the following link.
Reading SAS data in. net using ADO and ADO. net
Http://support.sas.com/kb/25/276.html