## how to limit observations in a column with a specified number

Occasional Contributor
Posts: 5

# how to limit observations in a column with a specified number

[ Edited ]

`Below is a incomplete sample of raw scores(A,B,C) to standard scores (score), scores range from 0-150, variables A,B,C are raw scores.My question if I only want to report scores for between 20 to 26. But I want the first and last observation of table to look like the picture attached.Would this be even possible to do? data test; input scores A B C;datalines;19 0 . 120 . 2 .21 1 . 222 . 3 323 2 . .24 . . .25 . . .26 3 . .27 . 4 . 28 . 5 429 5 . 530 6 . 6;run;`

Super User
Posts: 13,292

## Re: how to limit observations in a column with a specified number

Yes a table like that can be made. However some information is needed (and depending on the answers may not be a real simple process)

Are the 1 for A,  1-3 for B and 1-4 for C in row one supposed to come from a data value? Your example of missing as the only B value for score less than 20, plus only a value of 1 for C and 0 for A displayed as 1 isn't exactly clear..

Similar for the last row: where do 5-10, 6-23 and 7-15 come from?

If the values are fixed text that is one thing but if the displayed value is supposed to come from the variables A B or C we need a rule and an obvious one isn't coming to mind.

Occasional Contributor
Posts: 5

## Re: how to limit observations in a column with a specified number

[ Edited ]

Yes those numbers are suppose to come from the data value from the inputs.

(A,B,C) can range from  ( 0 to 10 for A ) and B (0- 22 for B), (0 to 15 for C).(this is typical range and not fixed, am dealing with multiple tables)

Am required to display the standard score from 20-26,

Any raw-scores for A,B,C that is not shown will be listed as 1 for A, 1-2 for B ( typo on table ) and 1-4 for C..in the first row.

Same concept for the last row, what ever not shown will be put into single last row.

It is not fixed...which is big problem, what do you suppose the solution will be if it is fixed?

Super User
Posts: 13,292

## Re: how to limit observations in a column with a specified number

[ Edited ]

BruceAlmighty wrote:

Yes those numbers are suppose to come from the data value from the inputs.

(A,B,C) can range from  ( 0 to 10 for A ) and B (0- 22 for B), (0 to 15 for C).(this is typical range and not fixed, am dealing with multiple tables)

Am required to display the standard score from 20-26,

Any raw-scores for A,B,C that is not shown will be listed as 1 for A, 1-2 for B ( typo on table ) and 1-4 for C..in the first row.

Same concept for the last row, what ever not shown will be put into single last row.

It is not fixed...which is big problem, what do you suppose the solution will be if it is fixed?

And the rules for what actual value is displayed for the last row? How do I know to show 7 to 15 instead of 8-19 for instance? Describe HOW to determine the displayed text given a data set.

I understand that your example data is incomplete, but to display text that changes and has such stuff as 7-15 we need to know exactly what we need to find to determine that given range.

And what does "not shown" mean in this phrase " not shown will be listed as 1 for A, 1-2 for B ( typo on table ) and 1-4 for C"? Your example had data for C=1 as a raw score. so how do we identify "not shown"?

I think as a minimum you need to post different example data and the corresponding table built only using example data. You have lots' of other things that don't make sense as show. For Score=20 your example data has C missing but the example table shows 5 for C on that row; score=21 B is missing but displays 3 and A and C in the table are missing but they have values of 1 and 2. Note of the example table rows make any sense with the given test data set.

Highlighted
Occasional Contributor
Posts: 5

## Re: how to limit observations in a column with a specified number

Sorry for the confusion it was error in my part. let's start fresh.

The sample data have 4 variables type, score, A and B. Score is standard score. A and B are raw scores. Am trying to create raw score to standard conversion table by type.

I have attached a picture for reference of exactly how I want my report look like.

Let's say for example, am required to only report standard scores between 10-20.

Scores below 10 will collapsed into a category of "<10" and scores above 20 will collapsed into a category of ">30".

Any values associated with these categories will become " x-y" as show in first row of table 1 as   "1-3".

data sample;
input type score A B;
cards;
1 0 . .
1 1 . 1
1 2 . 2
1 3 1 .
1 4 . 3
1 5 2 4
1 6 . 5
1 7 . 6
1 8 . .
1 9 3 .
1 10 4 .
1 11 5 .
1 12 6 7
1 13 . 8
1 14 . 9
1 15 . 10
1 16 . .
1 17 . 11
1 18 8 .
1 19 . .
1 20 9 12
1 21 10 13
1 22 . .
1 23 . 15
1 24 . 16
1 25 . .
1 26 11 .
1 27 12 .
1 28 . .
1 29 13 .
1 30 14 .
2 0 . .
2 1 . .
2 2 . 1
2 3 1 2
2 4 . .
2 5 2 .
2 6 . .
2 7 . 3
2 8 3 4
2 9 . 5
2 10 4 .
2 11 5 6
2 12 . 7
2 13 . .
2 14 . 8
2 15 6 .
2 16 7 9
2 17 8 10
2 18 9 11
2 19 . 12
2 20 10 .
2 21 11 .
2 22 . 13
2 23 12 14
2 24 13 15
2 25 14 .
2 26 . .
2 27 . 16
2 28 . .
2 29 . .
2 30 . .
;run;

Discussion stats
• 4 replies
• 115 views
• 0 likes
• 2 in conversation