data have; infile datalines delimiter=","; input NUM_PTR_NIV_0 NUM_PTR_NIV_1 NUM_PTR_NIV_2 NUM_PTR_NIV_3 ; datalines ; 08000000080,08000000190,08000000080,08000011800 08000000080,08000000190,08000000080,08000905580 08000000087,08000000190,08000000080,08000011320 08000000087,08000000190,08000000080,08000011150 08000000080,08000000190,08000000080,08000010840 08000000081,08000001190,08000000180,08000905580 08000000082,08000002190,08000000280,08000011320 08000000083,08000003190,08000000380,08000011150 08000000084,08000004190,08000000480,08000010840 run ; data want; infile datalines delimiter=","; input NUM_PTR ; datalines ; 8000000080 8000000087 8000000081 8000000082 8000000083 8000000084 8000000190 8000001190 8000002190 8000003190 8000004190 8000000180 8000000280 8000000380 8000000480 8000011800 8000905580 8000011320 8000011150 8000010840 run ;
hello,
i have many partners number in different level;
i would like to get a list of all partners in a column
many thanks for your help
kind regards
Nasser
data want;
set have;
array x num_ptr_niv:;
do i=1 to dim(x);
num_ptr=x(i);
output;
end;
drop i num_ptr_niv:;
run;
data want;
set have;
array x num_ptr_niv:;
do i=1 to dim(x);
num_ptr=x(i);
output;
end;
drop i num_ptr_niv:;
run;
Or consider how you read the raw data:
data have; infile datalines delimiter=","; input NUM_PTR @@ ; datalines ; 08000000080,08000000190,08000000080,08000011800 08000000080,08000000190,08000000080,08000905580 08000000087,08000000190,08000000080,08000011320 08000000087,08000000190,08000000080,08000011150 08000000080,08000000190,08000000080,08000010840 08000000081,08000001190,08000000180,08000905580 08000000082,08000002190,08000000280,08000011320 08000000083,08000003190,08000000380,08000011150 08000000084,08000004190,08000000480,08000010840 ;
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.
Ready to level-up your skills? Choose your own adventure.