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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 704 views
  • 0 likes
  • 2 in conversation