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

Hi,

 

I am doing a many-to-one merge of two data sets. one is the source data set and the other has two variables; id to merge on and the other one 'Date' which is in below format in excel sheet;

 

21/07/2017

Null

08/02/2018

Null

 

So when I am merging the two data sets, the values I am seeing in the merged set for 'Date' are like;

 

42937

Null

42971

Null

 

Can someone help with writing the right code please?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@sks521 wrote:

Thanks but how to save multiple worksheets as csv?


File - Save as, as usual. If you are concerned about the workload, just take into account the troubles you have right now.

 

A sustainable data handling process needs to keep Excel files out of the loop completely.

View solution in original post

8 REPLIES 8
sks521
Quartz | Level 8

SAS log is also giving me this message;

'One or more variables were converted because the data type is not supported by the V9
engine. For more details, run with options MSGLEVEL=I.'

 

Thanks

Sarwat

PeterClemmensen
Tourmaline | Level 20

Simply use the ddmmyy10. format like

 

format date ddmmyy10.;

 

sks521
Quartz | Level 8

Thanks, where should I use this command, in merging syntax?

sks521
Quartz | Level 8

And if I use it in the proc import step, I get this error message;

 

NOTE: VARCHAR data type is not supported by the V9 engine. Variable DateIntStarted has been
converted to CHAR data type.
ERROR: You are trying to use the numeric format DDMMYY with the character variable
DateIntStarted in data set WORK.GPDATA.

Kurt_Bremser
Super User

Start by getting rid of Excel files as a data source. Save the spreadsheets as csv files and read those with data steps; this will give you control over the whole process, so you can properly set variable attributes.

 

While fixing your process this way, you should post your merge code and the log from it. Posting example data in data steps with datalines will also be helpful.

sks521
Quartz | Level 8

Thanks but how to save multiple worksheets as csv?

sks521
Quartz | Level 8

So now I have created separate csv for each excel worksheet, imported them into SAS and merging went fine with one date variable having both var and char formats in one. I hope I am on the right track!

 

Thanks for all your help.

 

Kurt_Bremser
Super User

@sks521 wrote:

Thanks but how to save multiple worksheets as csv?


File - Save as, as usual. If you are concerned about the workload, just take into account the troubles you have right now.

 

A sustainable data handling process needs to keep Excel files out of the loop completely.

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
  • 8 replies
  • 1218 views
  • 1 like
  • 3 in conversation