I'm a long-time SAS user recently transitioning to SAS DI Studio 4.9 from SAS EG & SAS Desktop.There been some small bumps in the road with this transition.
For example. I'd like to read in a simple external text file of customer numbers.So I've created a new "External File Transformation" in the job folder. That works fine. I can right-click the external file transformation and open the file or view the file as a table - perfect.
Step 2: I pull a "File Reader Transformation" onto the job work space and connect the External File Transformation to the "File Reader Tansformation.
Step 3: I go into "File Reader Transformation" properties - mapping and add an expression in to the target table colum to extrtact a substring
that takes only the first 13 characters of the customer no. (substr(custno, 1,13) so the output or target table should have 1 13-character column
Here's the code from the File Reader Transformation.
/*==========================================================================*
* Step: User Written A5Y0E07I.$0000649 *
* Transform: User Written *
* Description: *
* *
* Source Table: Dat_Numbers - A5Y0E07I.C30001DW *
* /data/skynet/files/custom_billing/c *
* b_general/SMG_16th_Dat_nos.txt *
* Target Table: User Written - work.W29KIED A5Y0E07I.$0000651 *
* *
* User Written: SourceCode *
*==========================================================================*/
%let transformID = %quote(A5Y0E07I.$0000649);
%let trans_rc = 0;
%let etls_stepStartTime = %sysfunc(datetime(), datetime20.);
/* Runtime statistics macros */
%etls_setPerfInit;
%perfstrt(txnname=%BQUOTE(_DISARM|&transformID|&syshostname|UserWritten), metrNam6=_DISROWCNT, metrDef6=Count32) ;
%let _INPUT_count = 1;
%let _OUTPUT_count = 1;
%let _OUTPUT = work.W29KIED;
%let _OUTPUT_connect = ;
%let _OUTPUT_engine = ;
%let _OUTPUT_memtype = DATA;
%let _OUTPUT_options = %nrquote();
%let _OUTPUT_alter = %nrquote();
%let _OUTPUT_path = %nrquote(/User Written_A5Y0E07I.$0000651%(WorkTable%));
%let _OUTPUT_type = 1;
%let _OUTPUT_label = %nrquote();
/* List of target columns to keep */
%let _OUTPUT_keep = Bill_no_;
%let _OUTPUT_col_count = 1;
%let _OUTPUT_col0_name = Bill_no_;
%let _OUTPUT_col0_table = work.W29KIED;
%let _OUTPUT_col0_length = 28;
%let _OUTPUT_col0_type = $;
%let _OUTPUT_col0_format = $28.;
%let _OUTPUT_col0_informat = $28.;
%let _OUTPUT_col0_label = %nrquote(Billing_number_Date);
%let _OUTPUT_col0_input0 = Bill_no_;
%let _OUTPUT_col0_exp = ;
%let _OUTPUT_col0_input = Bill_no_;
%let _OUTPUT_col0_input_count = 1;
%let _OUTPUT1 = work.W29KIED;
%let _OUTPUT1_connect = ;
%let _OUTPUT1_engine = ;
%let _OUTPUT1_memtype = DATA;
%let _OUTPUT1_options = %nrquote();
%let _OUTPUT1_alter = %nrquote();
%let _OUTPUT1_path = %nrquote(/User Written_A5Y0E07I.$0000651%(WorkTable%));
%let _OUTPUT1_type = 1;
%let _OUTPUT1_label = %nrquote();
/* List of target columns to keep */
%let _OUTPUT1_keep = Bill_no_;
%let _OUTPUT1_col_count = 1;
%let _OUTPUT1_col0_name = Bill_no_;
%let _OUTPUT1_col0_table = work.W29KIED;
%let _OUTPUT1_col0_length = 28;
%let _OUTPUT1_col0_type = $;
%let _OUTPUT1_col0_format = $28.;
%let _OUTPUT1_col0_informat = $28.;
%let _OUTPUT1_col0_label = %nrquote(Billing_number_Date);
%let _OUTPUT1_col0_input0 = Bill_no_;
%let _OUTPUT1_col0_exp = ;
%let _OUTPUT1_col0_input = Bill_no_;
%let _OUTPUT1_col0_input_count = 1;
%rcSet(&syserr);
%rcSet(&sqlrc);
%perfstop(metrVal6=%sysfunc(max(&etls_recnt,-1)));
%let etls_recnt=-1;
/** Step end User Written **/
Step 4: Save the job. Right-click the "File Reader transformation" select "Run selected transformation.. -thats it Now I'd expect to see
successful execution of the new table with a single column - simple right. In SAS Desktop and SAS EG this is maybe 10 lines of code using an "infile statement" However that is not the case in SAS DI Studio and this is what makes the transition to SAS DI Studio so difficult.
When I attempt to open the table I get the error message " There was an error while initializing view data - Error fetching library Cannot fetch data.. I've never seen a error like this with SAS Desktop or SAS EG. (See attached). I appreciate any suggestions on how to rresolve this error. Thank you very much in advance. Dphilip
Hi @dphilip01
It would be a great help if you posted the full job. Open the code pane in the job editor (found next to the active diagram-pane), copy the whole DI Studio job code and post it as SAS code (a box to paste the code into opens if you click on the "running man icon").
Forgot - post the log as well - use the {i} symbol to get a box
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.