BookmarkSubscribeRSS Feed
Nupur20
Calcite | Level 5

Hi,

I have a dataset lke this:

Company Name                      Sample

A                                              15

B                                               25

C                                               14

D                                               30

E                                               28

I want to put aterisk (*) in front of the company name with sample less than 25.

My final dataset would look like:

Company Name                      Sample

*A                                              15

B                                               25

*C                                               14

D                                               30

E                                               28

I would appreciate your time suggestions reagrading the same.

Thanks a lot

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  Do you really want a final dataset or do you want a report? This is fairly simple to accomplish in a DATA step program with a statement something like (untested code):

data new;

  length company $20;  /* make company variable large enough to include the * (asterisk) */

  set original;

  if sample lt 25 then company=catt('*',company);

run;

  However, if what you want is a final report (such as an HTML, RTF or PDF file), then you could use PROC REPORT to change the color of the entire ROW with SAMPLE lt 25 to some color like yellow....in which case, an asterisk might not be needed. But of course, you can't change the color of a row in a dataset -- only in a report that goes to a destination which supports style changes.

cynthia

Linlin
Lapis Lazuli | Level 10

data have;

length company $ 12;

input company $ sample;

company=ifc(sample<25,catt('*',company),company);

cards;

A                                              15

B                                               25

C                                               14

D                                               30

E                                               28

;

proc print;run;

Linlin

kuridisanjeev
Quartz | Level 8

data have;

length company $ 12;

input company $ sample;

cards;

A                                              15

B                                               25

C                                               14

D                                               30

E                                               28

;

run;


data have1;

set have;

if sample lt 25 then company="*"||strip(company);

else company=company;

run;

Sanjeev.K

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 914 views
  • 0 likes
  • 4 in conversation