Hi
This is Ibrahim researcher student at UCD in Ireland
I’m looking for code that will solve this issue
look at COW_ID COLUMN
I want to make a new column which represents how many time each observation repeated in column
For example, if the number 72050556 repeated six times in my original dataset column, I would like to print a number 6 in the new column in front of these numbers (72050556) as well as the other repeating times
BEST REGARDS
Ibrahim
post sample data in the form of a datastep if you want a code answer.
PROC FREQ or PROC SQL are probably your best choices.
This is my data
I have over one million
regards
@Barkamih wrote:
This is my data
I have over one million
regards
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
Best is to either provide a data step to create data and another to show the desired result for the example data, or provide an example using a SAS supplied data set.
Did you look at the example in my other post?
If I understand your request then there are two parts involved: 1 is count the number of times a value occurs and the second is to merge that value back onto the original data.
Here's one way with a SAS supplied data set you can test.
proc sql; create table want as select a.*, b.agecount from sashelp.class as a left join (select age, count(*) as agecount from sashelp.class group by age) as b on a.age=b.age ; quit;
It is best to post text as text pasted into a code box. Many users here do not want to open Microsoft format documents as security risks and others have organization policy or software that prevents them from opening such from unapproved sources.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.