data yourdata;
format finaltime time12.2;
infile cards dlm=',';
input age team finaltimec $ score;
finaltime = input(finaltimec,?? hhmmss.);
drop finaltimec;
cards;
20,1,55.49,1
22,1,1:23.57,2
34,1,NA,3
19,2,32.22,4
55,3,5:38.43,5
17,3,12:52.17,6
31,3,25.13,7
;
run;VARAIABLE IT
You didn't post the output you need yet.
finaltime = input(finaltimec,?? stimer.);
Xia Keshan
You didn't post the output you need yet.
finaltime = input(finaltimec,?? stimer.);
Xia Keshan
can you do me small favour
I want finaltime in the format of mm:ss.dd .
above question i have used format time12.2.
Instead of it with mmss12.2
Hi Xia Keshan,
Can you please send Me BASE SAS & ADV SAS NOTES and Doc.which really helpful or 2 to 3 yrs of experience guys.
Thanks,
Anita
Suppressing error messages and notes with the "??" modifier is NOT, I repeat NOT, helpful in locating problems!
Hi ,
we missing the variable called Place.and the place contain '--' that special character should present in the data set along with the variables.
Hi Xia Keshan,
the datavalues have been missed placed in the data set.
Hi Xia Keshan,
In the variable Stroke and Points we can see the special character ' [] ' .
OK. Here is :
data want;
infile 'c:\temp\MeetResults_SourceData_2.txt' truncover ;
input @;
length Gender age_group Distance course Stroke $ 100;
retain Gender age_group Distance course Stroke;
if prxmatch('/^\w+/',_infile_) then do;
input (Gender age_group Distance course Stroke ) ($);
end;
else if prxmatch('/\w+,/',_infile_) then do;
input places $ 1-4 Name $ 5-28 Age $ 29-33 Team $ 34-61 Finals $ 62-73 Points $ 74-80;
output;
end;
run;
Message was edited by: xia keshan
Message was edited by: xia keshan
Thank you !!
(1) if prxmatch('/^\w+/',_infile_) then do;
input (Gender age_group Distance course Stroke ) ($);
end;
(2) else if prxmatch('/\w+,/',_infile_) then do;
input places $ 1-4 Name $ 5-28 Age $ 29-33 Team $ 34-61 Finals $ 62-73 Points $ 74-80;
output;
end;
Please correct my understanding if i'm wrong.
(1) Here you are identifying that first letter(string) starts with character and you are specifying it as character
(2) Here you are mentioning the variables with lengths
what i observed here is is she cresting two different data sets?
Whats she wants i didn't understand she just mentioned that in data set she find special characters [].
I'm totally blank. can you explain please.
"(1) Here you are identifying that first letter(string) starts with character and you are specifying it as character"
Yes. The pattern match the line which starts with a word .
(2) Here you are mentioning the variables with lengths
No. I just match pattern a word plus a comma . or just match a comma only.
else if findc(',',_infile_) then do;
"what i observed here is is she cresting two different data sets?"
No. They all are a table he want.
"Whats she wants i didn't understand she just mentioned that in data set she find special characters []."
That the first code of mine I generated ,didn't post here ,just email him .
you saw a [] ,I think it is a carriage character '0D'x .
Xia Keshan
Hi All,
I have created a small macro to *Converting all character values to uppercase
%macro UPCASE_Var(_a_infile_,_a_outfile_);
data &_a_outfile_.;
set &_a_infile_.;
array Chars
do i = 1 to dim(Chars);
Chars = upcase(Chars);
end;
drop i;
run;
%mend;
%UPCASE_Var(sashelp.class,test1234);
But can some help me to write for all SASDATA SET in the Libname
%macro UPCASE_Var(libname);
code here....
%mend;
% UPCASE_Var(libname);
No need for Macro .
Here is an example , copying all the tables in SASHELP into WORK library.
filename y temp; proc cport library=sashelp file=y memtype=data outtype=upcase;run; proc cimport library=work infile=y;run;
Xia Keshan
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.