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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1087 views
  • 0 likes
  • 4 in conversation