SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to Create Thorn Delimited Text File in SAS

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 83
Accepted Solution

How to Create Thorn Delimited Text File in SAS

Hi,

 

I have a requirement to create a thorn delimited text file. But I am not sure the delimiter option to be used in SAS to create one. 

 

Sample Output with thorn delimiter highlighted:-

 

vJ7kn75NEl9244XnTWigCla568eToDVIySAfOOMdZkg=þYyYFumWrrBabvEPu/n7cNmhlOVu/8Rx0p0lRsYbwA10=þ2018-06-30þ0þ77984845669þþIþBþþ*þMSCGþ0þþ2018-06-30þREGþRþRþþþAIþOþOAþþ2011-01-10þMþ68216084þ60þ278702499þ00þþþOþ31

 

Can someone help here. 


Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 8,214

Re: How to Create Thorn Delimited Text File in SAS

I think you're looking for 'FE'x. e.g.:

proc export data=sashelp.class dbms=dlm 
            outfile='/folders/myfolders/test.txt'
            replace;
  delimiter='FE'x;
run;

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Super User
Posts: 10,534

Re: How to Create Thorn Delimited Text File in SAS

You can use hex code literals, eg dlm='09'x is a tab. You need to know the hex code of your "thorn".

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Solution
3 weeks ago
Super User
Posts: 8,214

Re: How to Create Thorn Delimited Text File in SAS

I think you're looking for 'FE'x. e.g.:

proc export data=sashelp.class dbms=dlm 
            outfile='/folders/myfolders/test.txt'
            replace;
  delimiter='FE'x;
run;

Art, CEO, AnalystFinder.com

 

Frequent Contributor
Posts: 83

Re: How to Create Thorn Delimited Text File in SAS

Thank you Art. This helps !
Frequent Contributor
Posts: 83

Re: How to Create Thorn Delimited Text File in SAS

data _null_;
set  SASHELP.CLASS end=EFIEOD; 
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
%let _EFIREC_ = 0;     /* clear export record count macro variable */
file '/folder/folder/class.txt' delimiter='þ' DSD DROPOVER lrecl=32767;
format Name $8. ;
format Sex $1. ;
format Age best12. ;
format Height best12. ;
format Weight best12. ;
if _n_ = 1 then do;
put
'Name'
'þ'
'Sex'
'þ'
'Age'
'þ'
'Height'
'þ'
'Weight'
;
end;
do;
EFIOUT + 1;
put Name $ @;
put Sex $ @;
put Age @;
put Height @;
put Weight ;
;
end;
if _ERROR_ then call symput('_EFIERR_',1);  /* set ERROR detection macro variable */
If EFIEOD then
call symput('_EFIREC_',EFIOUT);
run;

In between I built the above code and I am getting the same output. Do you expect any issues from the above code. ?

Super User
Posts: 8,214

Re: How to Create Thorn Delimited Text File in SAS

No! 

'þ' and 'FE'x

represent the same character.

 

Art, CEO, AnalystFinder.com

 

Frequent Contributor
Posts: 83

Re: How to Create Thorn Delimited Text File in SAS

Thanks Art !
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 218 views
  • 3 likes
  • 3 in conversation