BookmarkSubscribeRSS Feed
Grandhi4
Calcite | Level 5

Hi,

Any one can give '#' table code (example)

Thanks,

Suresh

4 REPLIES 4
Ksharp
Super User

Did you mean Hash Table ?

Grandhi4
Calcite | Level 5

Yes please !

Ksharp
Super User

There are lots of example at this Forum , search it you will get answer.

This example maybe too difficult for you . The code is used to split table.

data l;
input name $  age;
cards;
q    1
.    . 
e    3
.    .  
r    7
.    .  
w    6
;
run;
data _null_;
if _n_ eq 1 then do;
 if 0 then set l ;
 declare hash ha1(ordered:'a');
 declare hiter hi1('ha1');
 declare hash ha2;
  ha1.definekey('name','age');
  ha1.definedata('ha2');
  ha1.definedone();
end;
set l end=last;
if ha1.find()=0 then ha2.add();
 else do;
        ha2=_new_ hash(multidata:'y');
         ha2.definekey('name','age');
         ha2.definedata('name','age');
         ha2.definedone();
         ha2.add();
         ha1.add();
       end;
if last then do; n=-1;
               do while(hi1.next()=0);
                n+1;
                if n ne 0 then ha2.output(dataset: cats('l',n));
               end;
             end;
run;


Ksharp

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 756 views
  • 0 likes
  • 3 in conversation