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
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1297 views
  • 0 likes
  • 3 in conversation