BookmarkSubscribeRSS Feed
rohithverma
Obsidian | Level 7

Hi All,

I had a value in csv file where the backend data within that value contain two parts.How can i resolve those internal values and read into sas .

 

Please find the screen shot below.

 

rohithverma_0-1586973679262.png

 

4 REPLIES 4
ballardw
Super User

How did you read the csv file? If using a data step then read that column as character and parse the value if you need the two numbers. You don't really show us what you expect for the output.

 

Unless you are careful you may no longer have the same values after opening the file in Excel if you saved it afterwards.

 

 

RichardDeVen
Barite | Level 11

The dynamic resolution of an expression at DATA step run-time can be accomplishing by RESOLVEing the expression in the macro environment with the %SYSEVALF macro function.  Note the leading equals sign (=) will need to be ignored for proper evaluation.  RESOLVE returns the character string representing the formula result, so that return also needs to be INPUT. 

 

Example:

data x;
  remarks = '=1/7';

  if remarks =: '=' 
    then remarks_eval = input(resolve ('%sysevalf(' || substr(remarks,2) || ')' ), best12.);

  x = 1 / 7;
  delta = x - remarks_eval;

  put x= remarks_eval= delta=;
run;

Note: Some very small differences may be noticed between the actual ratio and the macro resolution of the ratio.

           x=0.1428571429
remarks_eval=0.1428571428
delta=5.714285E-11
fdsaaaa
Obsidian | Level 7

It can't be done as far as I can see. The screenshot is from excel . But if you save as .csv then you can no longer get the formula used to create the value in the cell . Try opening the csv up again in excel and you will see there is no longer a formula . This is all before it has even touched SAS .

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
  • 4 replies
  • 429 views
  • 0 likes
  • 5 in conversation