BookmarkSubscribeRSS Feed
Mohan_Reddy
Obsidian | Level 7

 

I want a output dataset have 20 tables like below come column wise..


1                    2                    3              4      5        6          7        8     ................................. 20

1*1=1             2*1=2                                                                                                             20*1=20

1*2=2             2*2=4                                                                                                              20*2=40

...                   ........

..                    .......

1*10=10          2*10=20                                                                                                         20*10=200


Like this i want output have 20 tables..

Please anyone write programme for this question ...   !!!!!!!

 

12 REPLIES 12
PeterClemmensen
Tourmaline | Level 20

Like this?

 

data have(drop=i j);
   array c {20};
   do i = 1 to 10;
      do j = 1 to 20;
         c [j] = i*j;
      end;
   output;
   end;
run;
Mohan_Reddy
Obsidian | Level 7

Almost correct....But in output we get after multiplication values only....we want 1*1=1        2*1=2   3*1=3   4*1=4  . .............20*1=20

                                                                                                                               1*2=2       2*2=4   3*2=6   4*2=8  ..............  20*2=40

                                                                                                                                ...........................................................................

                                                                                                                                1*10=10   2*10=20  3*10=30  4*10=40  ..........20*10=200

 

Like this before multiplication format also come into output...i hope you understand my question....!!!

Mohan_Reddy
Obsidian | Level 7
Almost but output dataset have only after multiplication values.....
But we want before multiplication format also like
1*1=1 2*1=2 3*1=3 ...................20*1=20
.............................................................
1*10=10 2*10=20 3*10=.................20*10=200

like this we want output...so please help in a programme
PeterClemmensen
Tourmaline | Level 20

I fail to see why, but there you go

 

data have(drop=i j);
   array c {20} $;
   do i = 1 to 10;
      do j = 1 to 20;
         c [j] = cats(j, '*', i, '=', i*j);
      end;
   output;
   end;
run;
Mohan_Reddy
Obsidian | Level 7

Thankyou for your help....but in output we get values like   1*1=1   1*2=2   1*3=3..........................1*20=20

                                              

                                                                                              10*1=10  10*2=20  10*3=30.............. 10*20=200  

 

 

but we want values in correct order like  1*1=1  2*1 3*1=3 ................................20*1=20

 

 

                                                                 1*10=10  2*10=20  3*10=30....................20*10=200  Like this order wise we get table..please have a look on problem just modify that..how we get tables in order type...

PeterClemmensen
Tourmaline | Level 20

Ok, I just changed the values around. Please try again.

Mohan_Reddy
Obsidian | Level 7

Almost ok but output dataset have only after multiplication values.....
But we want before multiplication format also like
1*1=1 2*1=2 3*1=3 ...................20*1=20
.............................................................
1*10=10 2*10=20 3*10=.................20*10=200

like this we want output...so please help in a programme

PeterClemmensen
Tourmaline | Level 20

Please run my code above. Does exactly what you ask.

Mohan_Reddy
Obsidian | Level 7
I want output dataset have 20 Tables like below.. in Horizontal wise

1            2          3    4    5    6   7  8  9     ........................             20
--          ---        --    --   --   --- -- -- ---   .......................              --
1*1=1       2*1=2                                                                         20*1=20
1*2=2       2*2=4                                                                         20*2=40
1*3=3       2*3=6                                                                         20*3=60
.......    ........                                                                      ..........
.......    ........                                                                      ..........
.......    ........                                                                      ..........
1*10=10    2*10=20                                                                       20*10=200

Like this i want 20 Tables in output dataset....

If anyone know how to get this please write a programme in SAS !!!
Kurt_Bremser
Super User

I moved this question back into the original thread with the same question. Pleade do not clutter the forum with unnecessary double posts, study the answers already given.

andreas_lds
Jade | Level 19

The words "dataset" and "table" are often used synonymous, so your request


@Mohan_Reddy wrote:

 

I want a output dataset have 20 tables like below come column wise..

does not make any sense.

Mohan_Reddy
Obsidian | Level 7
I want output dataset have 20 Tables like below.. in Horizontal wise

1 2 3 4 5 6 7 8 9 ........................ 20
-- --- -- -- -- --- -- -- --- ....................... --
1*1=1 2*1=2 20*1=20
1*2=2 2*2=4 20*2=40
1*3=3 2*3=6 20*3=60
....... ........ ..........
....... ........ ..........
....... ........ ..........
1*10=10 2*10=20 20*10=200

Like this i want 20 Tables in output dataset....

If anyone know how to get this please write a programme in SAS !!!
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
  • 12 replies
  • 2963 views
  • 0 likes
  • 4 in conversation