BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

A sas program is easier to read when it is well formatted (space and tabs).  But I am losing the tab  the tabs when I transfer my SAS program to winscp and same thing for the other way around.

 

How to solve that issue?  See the example below:

 

Data dest2.found_agrmt_&genv._&suffix._&suffix2.;

 attrib 

         KEY                           label="Record to be anonymized key" 	length=$31. 	format=$char31.		informat=$char31.
		  ORGNL_SAS_DS_ROW_NBR          label="Original SAS dataset Row number"	length=8 		format=8.		 	informat=8.
		  agreement_nbr					label="Agreement Number" 				length=$20. 	format=$char20.		informat=$char20.
		  cie        					label="company cd " 				    length=$2. 		format=$char2.		informat=$char2.
          lob        					label="Line Of Business" 				length=$4. 		format=$char4.		informat=$char4.
 		  year							label="Year" 					        length=$4. 		format=$char4.		informat=$char4.
          month							label="Month" 							length=$3.  	format=$char3.		informat=$char3.		  
		  libname					    label="path" 							length=$100.	format=$char100.    informat=$char100.
		  filename					    label="Dataset Name" 					length=$25. 	format=$char25.		informat=$char25.
		  company_cd                    label="Company CD"                      length=$1. 	    format=$char1. 	    informat=$char1. 
		  policy_expiry_date            label="Policy Expiry Date"              length=8        format=yymmdd10.    informat=yymmdd10.

  AGREEMENT_NBR_DR    	 		label="Agreement Number Data Retention" length=$25. 	format=$char25. 	informat=$char25.
		  LINE_OF_BUSINESS				label="Line of Business" 				length=$3.  	format=$char3.  	informat=$char3.
		  PROVINCE       				label="Province" 						length=$10. 	format=$char10. 	informat=$char10.
		  LEGACY_UNDERWRITING_COMPANY 	label="Legacy Underwriting Company" 	length=$10.	    format=$char10.     informat=$char10.
		  UNDERWRITING_COMPANY       	label="Underwriting Company" 			length=$10. 	format=$char10. 	informat=$char10.
		  DISTRIBUTOR_NUMBER			label="Distributor Number" 				length=$10. 	format=$char10. 	informat=$char10.
		  DISTRIBUTOR_NUMBER_SRC	    label="Distributor Number Source" 		length=$10. 	format=$char10. 	informat=$char10.
		  SOURCE_SYSTEM 	 			label="Source System"					length=$15. 	format=$char15. 	informat=$char15.
		  DATASOURCE_BACKEND_REFERENCE	label="Data Source Backend Reference"	length=$10. 	format=$char10. 	informat=$char10.
		  LAST_TERM_EFFECTIVE_DATE    	label="Last Term Effective Date" 		length=8 		format=YYMMDD10. 	informat=YYMMDD10.
		  LAST_TERM_EXPIRY_DATE 		label="Last Term Expiry Date" 			length=8		format=YYMMDD10. 	informat=YYMMDD10.
		  CONTRACT_UUID					label="Contract UUID" 					length=$36. 	format=$char36. 	informat=$char36.
   ;
stop;
run;

Please note that the format is worst in SAS EG or in winscp

How to solve that issue?

4 REPLIES 4
Tom
Super User Tom
Super User

Why would WINSCP do anything with tab characters?  I have never seen it do anything like that.

 

In the old days when using FTP instead of SFTP is was important to indicate whether you wanted the file copied as BINARY or TEXT.  Since Windows and Unix used different character string to mark the end of lines in text files using the wrong one could result in corruption of the file.  SFTP just uses binary copies.

 

But I have never seen anything in WinSCP (or other file copy tools) that would effect TAB characters.

Tom
Super User Tom
Super User

Most likely it is not WINSCP that is causing the issue.  Instead it is opening the file in different editors (or on different systems) that are using different definitions of where the tab stops are supposed to be placed.  Some people might prefer that tab stops are aligned at every 8 spaces, but others might prefer 4 or even 2 spaces.

 

That is just one of the many reasons to NOT place physical TAB characters into your program files.  Instead just use the TAB key the same way it worked on a typewriter. It is just a command to move to the next tab stop.  Editors that understand this will fill in the spaces for you.  Then the file looks the same when viewed with a different tab stop setting.

data_null__
Jade | Level 19

You have a mixture of tabs and spaces which causes the inconsistent alignment.  I like to set my editor to insert spaces for tabs and try to convert any tabs that may be copied from external sources, to spaces.  I like tab stops every 3 spaces.  

 

The picture below is your file viewed in ultra-edit with view options to show tabs, spaces, and line endings. 

 

Capture.PNG

Kurt_Bremser
Super User

Concur with what the others said. Set your editor so that it replaces the tabs with spaces whenever tabs are entered. This also prevents the effects of different tab-width settings on different systems.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 518 views
  • 4 likes
  • 4 in conversation