BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

dear all, 

i have the data of the companies and their directors. in the below format 

Company NameDirector Name
20 Microns Ltd.CHANDRESH PARIKH
 RAJESH PARIKH
 ATIL C PARIKH
 SEJAL R PARIKH (MRS.)
 P M SHAH
 R A DEVIDAYAL
 ATUL H PATEL
 AJAY I RANKA (DR.)
 JAIDEEP VERMA
3I Infotech Ltd.ASHOK SHAH
 SAROJINI DIKHALE (MS.)
 SHASHANK DESAI (DR.)
 GAUTAM DUTTA
 SHANTI LAL JAIN
 ANJOO NAVALKAR
 AVAYA KUMAR MOHAPATRA
 RAJEEV KUMAR SINHA
 PADMANABHAN IYER
3M India Ltd.BHARAT D SHAH
 BIREN GABHAWALA
 RADHIKA RAJAN
 DEBARATI SEN
 B V SHANKARANARAYANA RAO
 ALBERT C WANG
 AMIT LAROYA
 RAMESH RAMADURAI
 JONG HO LEE
 SADHANA KAUL
3P Land Holdings Ltd.G N JAJODIYA
 VASUDHA JATIA (MS.)
 R C SARAF
 A K SOMANY
 BHAVANISINGH SHEKHAWAT

in the above format,  i have to fill the blank rows in the company name column with the company in the preceding row. as follows

Company NameDirector Name
20 Microns Ltd.CHANDRESH PARIKH
21 Microns Ltd.RAJESH PARIKH
22 Microns Ltd.ATIL C PARIKH
23 Microns Ltd.SEJAL R PARIKH (MRS.)
24 Microns Ltd.P M SHAH
25 Microns Ltd.R A DEVIDAYAL
26 Microns Ltd.ATUL H PATEL
27 Microns Ltd.AJAY I RANKA (DR.)
28 Microns Ltd.JAIDEEP VERMA
3I Infotech Ltd.ASHOK SHAH
3I Infotech Ltd.SAROJINI DIKHALE (MS.)
3I Infotech Ltd.SHASHANK DESAI (DR.)
3I Infotech Ltd.GAUTAM DUTTA
3I Infotech Ltd.SHANTI LAL JAIN
3I Infotech Ltd.ANJOO NAVALKAR
3I Infotech Ltd.AVAYA KUMAR MOHAPATRA
3I Infotech Ltd.RAJEEV KUMAR SINHA
3I Infotech Ltd.PADMANABHAN IYER
3M India Ltd.BHARAT D SHAH
3M India Ltd.BIREN GABHAWALA
3M India Ltd.RADHIKA RAJAN
3M India Ltd.DEBARATI SEN
3M India Ltd.B V SHANKARANARAYANA RAO
3M India Ltd.ALBERT C WANG
3M India Ltd.AMIT LAROYA
3M India Ltd.RAMESH RAMADURAI
3M India Ltd.JONG HO LEE
3M India Ltd.SADHANA KAUL
3P Land Holdings Ltd.G N JAJODIYA
3P Land Holdings Ltd.VASUDHA JATIA (MS.)
3P Land Holdings Ltd.R C SARAF
3P Land Holdings Ltd.A K SOMANY
3P Land Holdings Ltd.BHAVANISINGH SHEKHAWAT

please suggest me a suitable SAS code 

thanks in advance 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

 

data want;
 set have;
 retain _t;
 if missing(Company_name) then Company_name=_t;
 else _t=Company_name;
 drop _t;
run;

 

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

 

data want;
 set have;
 retain _t;
 if missing(Company_name) then Company_name=_t;
 else _t=Company_name;
 drop _t;
run;

 

srikanthyadav44
Quartz | Level 8
thanks . the SAS code is working excellently
ballardw
Super User

I think you likely should go back to how you created your "want" data and fix the almost-certainly-done-incorrectly by Excel incrementing of the "20 Microns" to "21 Microns" "22 Microns" etc.

 

Never trust Excel for dragging values if there is a number-like value as part of text. Never.

 

I had a project where someone did this to a designed sample file and created 200 more school identifiers than existed in the region.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 412 views
  • 5 likes
  • 3 in conversation