BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BigPete
Obsidian | Level 7

Is there anyway to make the designated SPLIT value apply to strings displayed through the table besides main and column titles? I'm using SAS 9.4.

 

I pre-incorporated in one test but it didn't seem to work. It didn't work either even when I tried concatenating some string variables via COMPUTE block in PROC REPORT. What am I missing?

 

data addy;
  infile datalines dlm='|';
  input name ~$15. address ~$15. city $ state $;
datalines;
Debby Jones|1234 Johnny St|Chicago|IL
Joe Smith|2345 Bobby Dr|New York|NY
Ron Lee|3456 Suzy Ln|Miami|FL
;
run;

data addy_report_feed;
  set addy;
  catty=catx('~',name,address,catx(', ',city,state));
run;

/* test 1 */
proc report data=addy_report_feed split='~';
  column state city name catty;

  define state / display noprint order=internal;
  define city / display noprint order=internal;
  define name / display noprint order=internal;
  define catty / group 'Mailing~Address' flow width=30;

  break after catty / skip;
run;

/* test 2 */
proc report data=addy_report_feed split='~';
  column state city address name addblock;

  define state / display noprint order=internal;
  define city / display noprint order=internal;
  define address / display noprint order=internal;
  define name / display noprint order=internal;
  define addblock / computed 'Mailing~Address' flow width=30;

  compute addblock / char length=40;
	addblock=catx('~',name,address,catx(', ',city,state));
  endcomp;

/*  break after addblock / skip;*/
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Use escapechar:

 

 

 

ods escapechar='^';
.................
compute
addblock / char length=40; addblock=catx('^n',name,address,catx(', ',city,state)); endcomp;

 

Fixed a problem

View solution in original post

2 REPLIES 2
SASKiwi
PROC Star

If I understand you correctly you appear to be trying to turn your columns of data into rows just using PROC REPORT.

 

An easier approach might be to transform your data first by creating a general text column that contains name on row 1, address on row 2, city on row 3, state on row 4 and so on. You could use a DATA step or PROC TRANSPOSE for this.

 

Once your data is transformed it makes your PROC REPORT a lot easier.

Ksharp
Super User

Use escapechar:

 

 

 

ods escapechar='^';
.................
compute
addblock / char length=40; addblock=catx('^n',name,address,catx(', ',city,state)); endcomp;

 

Fixed a problem

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!

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
  • 2 replies
  • 7864 views
  • 2 likes
  • 3 in conversation