BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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"

1 REPLY 1
Tom
Super User Tom
Super User

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_)(~); 

return

names: 

   length _name_ $32

   do while(1); 

      call vnext(_name_); 

      if upcase(_name_) eq '_NAME_' then leave

      put _name_ ~ @; 

   end

   put

return

run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1017 views
  • 0 likes
  • 2 in conversation