Help using Base SAS procedures

Place quotes around column header and data

Regular Contributor
Regular Contributor
Posts: 238

Place quotes around column header and data

I have an infile that stores in my work.temp and I want to have the ability to put " " around the column headers and the data itself. The data is text and numeric. I need the data formatted like this and then export to a .csv comma dil to FTP to someone that needs it in that format for their intake system. I have looked and looked all over and cannot find any information on how to perform this. Is it a data have data want?

Data Have

MID                memID     add                          add2         city          state          zip          age

111                 11111   123 chase street                         newark     nj          01010         52

Data Need

"MID"           "memid"          "add"                              "add2"          "city"          "state"          "zip"          "age"

"111"          "11111"           "123 chase street"           " "               "newark"     "nj"             "01010"     "52"

Super User
Super User
Posts: 8,127

Re: Place quotes around column header and data

Use the technique posted by @data_null_; here: 

Just adjust to use the ~ modifier instead of the : modifier to force the quotes.

Also did you want TAB delimited like your example or COMMA delimited (which is what CSV means).

data _null_

   set SASHELP.class; 

   file log dlm=',' dsd; 

   if _n_ eq 1 then link names; 

   put (_all_)(~); 



   length _name_ $32

   do while(1); 

      call vnext(_name_); 

      if upcase(_name_) eq '_NAME_' then leave

      put _name_ ~ @; 





Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation