I have the following table
data have;
input x1;
datalines;
1
2
3
4
5
6
7
8
9
10
11
;
run;
and I'm trying to create a macro variable which allocates the number of distinct entries up to a maximum of ten so I can automatically create the right number of bins for a histogram later (max 10 bins)
the code i'm currently trying to leverage is as follows but I'm unsure how to allocate the macro variable when there are more than 10 distinct observations
PROC SQL NOPRINT;
SELECT COUNT(DISTINCT X1)
INTO: BIN_X1
FROM HAVE
HAVING (COUNT(DISTINCT X1) LE 10);
QUIT;
How do I allocate the macro variable to be 10 if there are more than 10 distinct obs?