BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, All!

I want create an unique composite index in the data step for limit dumplicate rows inserted.

The Logic SAS Code may like following:

data work.wolf(index=(id name /unique ));
infile datalines dlm="|";
length id 8. name $10. age 8.;
input id name age;
datalines;
1|forest|10
2|forest|11
2|forest|12
3|forest|13
2|forest|14
;
run;

In the rows in the work.wolf as following:
1|forest|10
2|forest|11
3|forest|13

My SAS version is:9.2
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you start with the SAS documentation and the SAS support http://support.sas.com/ website (free) resources.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

data step programming composite index site:sas.com
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Wolf,

If I understood you correctly this could be a possible solution:

data work.wolf(/*index=(id name /unique )*/);
infile datalines dlm="|";
length id 8. name $10. age 8.;
input id name age;
datalines;
1|forest|10
2|forest|11
2|forest|12
3|forest|13
2|forest|14
;
run;
proc sort data=wolf nodupkey;
by id name;
run;
proc datasets library=work;
modify wolf;
index create idn=(id name);
run;

Sincerely,
SPR

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