BookmarkSubscribeRSS Feed
Proulx06
Calcite | Level 5

Large insurance company using SAS EG 4.3. We use the GUI interface.

I have a very simplistic process flow that ends with a table that has a single column of data in it. The final step in my process is to export this column of data to a text file, in a specific network folder, where an IT batch picks up the file and does other things with it. This SAS query is new, and this job was previously done by Hyperion Brio.

My issue is that this column of data is alphanumeric, and so it's considered text. When I add in the 'export as a step in the process', it exports to the right location, but puts quotes around the data elements. When the IT batch goes to grab the data, it errors out when it encounters the quotes.

At this point, the IT batch is not editable...as I said, we are a large insurance company and so any change in an IT batch requires time, prioritization, etc. But if I can fix the SAS query, we don't have to go through that process.

Is there a way to export a text field into a .txt file (which is required...no .csv) without qualifying the text field with quotes?

7 REPLIES 7
Reeza
Super User

I don't see an option via point and click, so most likely you'll have to add a program step.

Fortunately its a very simple one.

filename fileout "c:\_localdata\test.txt"; *path to folder with filename;

data _null_;

    file fileout;

    set sashelp.class;

    if _n_=1 then put "Name"; *Header information;

    put name; *variable to be exported;

run;

Proulx06
Calcite | Level 5

Thanks. Having never done any programming within SAS (but having some programming background here and there in school), can you help me understand how to bake this code into my existing process flow? I have about four queries, then a filter & sort, and then this export in my current flow. How do I replace the export step with the code above?

Reeza
Super User

Delete the export step.

Add a program (File>New>Program)

Modify the program so that it works for you set up.

Specifically, specify the file location, the variable name and for the SET statement, make sure it refers to the dataset you need.

You'll need to save the program somewhere in addition to the project.

I think you'll have to manually connect the program if you'd like it to appear at the end. Right Click the data set you're exporting, select Link To and select the program.

Proulx06
Calcite | Level 5

Thanks...getting closer! I have replaced the variables in your code above with my information, however now I'm getting this error:

ERROR: Insufficient authorization to access /usr/apps/sas/ConfigGrid/Lev1/SASAdhoc/C:\Temp\test\RCC_LETTER_INPUT.TXT.

My code is:

filename fileout "C:\Temp\test\RCC_LETTER_INPUT.TXT"; *path to folder with filename;

data _null_;

    file fileout;

    set sashelp.class;

    if _n_=1 then put "Policy_Number"; *Header information;

    put BLNG_CNTRCT_YR_MTH_ID; *variable to be exported;

run;

I get the same error when I attempt to write out to a network folder (which will be the eventual solution). I do have full write privileges for each location.. I realize you've basically solved my problem and that I'm likely dealing with a new issue...so let me know if I should open a new topic for this. Thanks.

ChrisHemedinger
Community Manager

You're running into the confusion that happens when SAS is "over there" but EG is running on your PC "right here".

See this blog post for some guidance:

Export and download any file from SAS Enterprise Guide - The SAS Dummy

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Ksharp
Super User

You need have right to write a file under OS command.

filename fileout temp;

data _null_;

    file fileout dsd  ;

    set sashelp.class;

    if _n_=1 then put "Policy_Number"; *Header information;

    put BLNG_CNTRCT_YR_MTH_ID ~ ; *variable to be exported;

run;


data _null_;

infile fileout;

input;

list;

run;



Xia Keshan

BrunoMueller
SAS Super FREQ

Please show what your text column looks like.

A test using EG6.1 (I know not your version) shows the following:

This data set

Is exported as:

newColumn,Name,Age

"Alfred,M,14",Alfred,14

"Alice,F,13",Alice,13

"Barbara,F,13",Barbara,13

"Carol,F,14",Carol,14

"Henry,M,14",Henry,14

Since the first column has the delimiter as part of the data, it is enclosed in double quotes, but the other columns that do not have delimiters are not put into quotes.

Now I do not have EG4.3 available to test, please check your data for the delimiter (the comma) in your data

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 6506 views
  • 7 likes
  • 5 in conversation