BookmarkSubscribeRSS Feed
SASJedi
SAS Super FREQ

DS2 supports very large VARCHAR() variables. You could probably re-assemble the JSON from your data using a technique something like this:

 

data test;
   length id 8 fake_json $ 32767;
   do id=97 to 122;
     fake_json=cats('{[',repeat(byte(id),32000),']}');
     output;
   end;
run;

proc ds2;
data _null_;
   dcl varchar(1000000) json;
   retain json;
   method run();
      json=json||strip(fake_json);
      set test;
   end;
   method term();
      put json=;
   end;
enddata;
run;
quit;

From the log you can see that we've been able to build a text string much longer than 32767.  Hope this helps 🙂

Mark

Check out my Jedi SAS Tricks for SAS Users

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 15 replies
  • 20649 views
  • 14 likes
  • 7 in conversation