Aditi
Aditi

Reputation: 117

Replace tabs in a string with equal no of spaces in SAS

I want to replace tabs with equal number of spaces in a string which I am reading from a file. The no. of spaces may vary depending on the editor.How to determine the no of spaces and replace as per in SAS 9.3? Please help.

Upvotes: 1

Views: 1046

Answers (2)

Tom
Tom

Reputation: 51611

If you are using SAS then the INFILE statement can expand the tabs for you.

data _null_;
  infile 'withtabs.txt' expandtabs ;
  file 'withspaces.txt' ;
  input;
  put _infile_;
run;

Upvotes: 8

Chris J
Chris J

Reputation: 7769

Not sure whether you can do this programatically (determining the current tab size setting), but you can do this via :

  • Tools > Options > Enhanced Editor > General > Insert spaces for tabs
  • Tools > Options > Enhanced Editor > General > Replace tabs with spaces on file open

Upvotes: 3

Related Questions