f



Re: How to read a period in a variable from a file to SAS dataset #2

On Mon, 28 Jul 2008 02:01:10 -0700, =?ISO-8859-1?Q?Rune_Runnest=F8?=
<rune@FASTLANE.NO> wrote:

>/*
>This is the file with the fileref MYFILE:
>
>---------------------------------------
>DOKTITTEL:  this is the first record
>---------------------------------------
>DOKTITTEL:  .
>---------------------------------------
>DOKTITTEL:  this is the third record
>---------------------------------------
>*/
>
>/*
>I want the second record to be '.', not ' '.
>How can I obtain that?
>
>Rune
>*/
>filename myfile "d:\temp\myfile.txt";
>
>data tp34_jn_dok;
>   length Dokumentbeskrivelse  $40. ;
>   infile myfile dlm=">>>" pad ;
>   input @"DOKTITTEL:" dokumentbeskrivelse ;
>run;

Use the $CHAR informat.
0
hs
7/28/2008 12:50:02 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
576 Views

Similar Articles

[PageSpeed] 17

Reply:

Similar Artilces:

Re: How to read a period in a variable from a file to SAS dataset
Rune, Your program is working if your dot is transformed into .. dot dot Or you may test internally filename myfile "d:\rune.txt"; data tp34_jn_dok; length Dokumentbeskrivelse $40. ; infile myfile dlm=">>>" pad ; input @"DOKTITTEL:" dokumentbeskrivelse ; if missing(dokumentbeskrivelse) then dokumentbeskrivelse='missing'; run; Now the question rise why to put a single dot (symbol of numeric missing) in place of a text like missing) as i do in my answer? HTH Andre Rune Runnest� a �crit : > /* > This is the file with the fileref MYFILE: > > --------------------------------------- > DOKTITTEL: this is the first record > --------------------------------------- > DOKTITTEL: . > --------------------------------------- > DOKTITTEL: this is the third record > --------------------------------------- > */ > > /* > I want the second record to be '.', not ' '. > How can I obtain that? > > Rune > */ > filename myfile "d:\temp\myfile.txt"; > > data tp34_jn_dok; > length Dokumentbeskrivelse $40. ; > infile myfile dlm=">>>" pad ; > input @"DOKTITTEL:" dokumentbeskrivelse ; > run; > > -- Andr� WIELKI INED (Institut National d'Etudes D�mographiques) Service Informatique 133 Boulevard Davout 75980 Paris Cedex 20 m�l : wielki@ined.fr t�l : 33 (0) 1 56 0...

Re: Is it possible to read a sas dataset NOT using sas? #2
I think SPSS and DBMSCopy can read SAS datasets. Also for sure WPS. Gerhard On Tue, 18 Mar 2008 06:43:44 -0700, RolandRB <rolandberry@HOTMAIL.COM> wrote: >Is it possible to read a sas dataset NOT using sas and have >observations and variables etc. rather than having meaningless chunks >of text? ...

How to read a period in a variable from a file to SAS dataset
/* This is the file with the fileref MYFILE: --------------------------------------- DOKTITTEL: this is the first record --------------------------------------- DOKTITTEL: . --------------------------------------- DOKTITTEL: this is the third record --------------------------------------- */ /* I want the second record to be '.', not ' '. How can I obtain that? Rune */ filename myfile "d:\temp\myfile.txt"; data tp34_jn_dok; length Dokumentbeskrivelse $40. ; infile myfile dlm=">>>" pad ; input @"DOKTITTEL:" dokumentbeskrivelse ; run; ...

Re: Creating SAS datasets from reading a file #2
Chandra, Couldn't you accomplish what you want by using Proc SQL to crete two macro variables and then use those variables in a data step? E.g., proc sql noprint; select distinct "dwproject_"||state, "if state eq '"||state||"' then output"|| " dwproject_"||state||";" into :data_st separated by ' ', :if_st separated by ' ' from stlist.del ; quit; data &data_st.; set del; &if_st.;; run; HTH, Art ------- On Fri, 11 Jul 2008 15:08:19 -0400, SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL.COM> wrote: >Nat, > >Thanks for the quick response. I could hard code those states. >Unfortunately, we definitely need to take the input from a file which is >subjected to change. That way, our users would like to have control on the >file. We don't want to change the SAS code whenever there is a change in >the input file that contains group of states. We definitely need to use >that file. > > > >On Fri, 11 Jul 2008 15:05:43 -0400, Nat Wooding <Nathaniel.Wooding@DOM.COM> >wrote: > >>Interesting -- this is around the third time today that this question has >>come up. You could use the approach >> >>Data dwproject_NY >> dwproject_md etc ; >> >>infile ... >>input ...; >> >>if state ='NY' then output dwproject_NY; else >>if state ='M...

Re: comparing pdf files and SAS Datasets for variables... #2
If I was in your shoes, I would try to convert the PDF to Excel so I could more easily manipulate and clean up the data. There are a number of products out there but a free one you can try (not tested myself) can be found at: http://www.brothersoft.com/office-convert-pdf-to-excel-for-xls-free-204767.h tml TinyURL: http://tinyurl.com/cutu96 Phil Philip Rack MineQuest, LLC SAS & WPS Consulting and WPS Reseller Tel: (614) 457-3714 Web: www.MineQuest.com Blog: www.MineQuest.com/WordPress -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Al Sent: 02/11/2009 5:52 PM To: SAS-L@LISTSERV.UGA.EDU Subject: comparing pdf files and SAS Datasets for variables... Hi , I don't know if this possible or not but here it is ..Is there a way to compare a case report forms (in pdf format ) and SAS datasets to know if all the variables listed in the crfs are present in the SAS datasets through a SAS Program.. I have around 40 CRF's for each of the 4 protocols.. its tedious doing manually .. Please direct me in the right direction.. Thanks in advance . ...

Re: Reading multiple .RPT files from a Folder into SAS dataset #2
It should not be hard, if 1. You have a reliable technique for reading *one* of the files. 2. The 30 files have a common structure. Focus on #1 first. You are getting ahead of yourself if you don't have a good answer. On Sat, 24 Jun 2006 08:01:04 -0700, SAS-1 <emailto.nishant@GMAIL.COM> wrote: >Hi >I have a folder containg around 30 .RPT ASCII text files and I need to >read all of them into a single SAS dataset. The .rpt files are huge and >doing the Import individually might be a time consuming effort. Is >there a method of reading files from a folder one by one ...

Re: How to read a SAS log into a SAS dataset.
lazybone2k@GMAIL.COM wrote: > >Dear SAS-L listers, >This may be the millionth time somebody is asking this question " how to >read a SAS log into a SAS dataset?". I looked at previous posts and >gathered info from various SUGI papers and found a way to get the log and >read it. But i dont know for some reason its not working. Please help me. >I used a Proc printto procedure to print the log to a external file >location and try to read in the log and create a SAS dataset which will >contain info about Filename, Owner name, Group name, Elapsed time, CPU >t...

Re: Converting Macro Variable to a SAS Dataset Variable #2
Sounds like you should address this at the step where you create the macro variable; instead of creating a macro variable, create a dataset (or a dataset variable). (I assume this is related to your other query, which indicates that you create this macro variable in PROC SQL). Can you post some code and sample data for how you arrive at &p1 in the first place? -Joe On Wed, Mar 18, 2009 at 10:22 AM, Siddharth Jain <sjain@aveopharma.com>wrote: > If I have a macro variable p1 where %put <<p1>>; results in <<p1>> > 01,02,03,06 > > > How do I bring value of p1 to a dataset. Can I make a dataset variable > which > has the same values as of p1. > > > Thanks in advance for your help, > Siddharth > ...

Re: Unable to read Unicode file into SAS file
Another possibility is that proc import isn't correctly getting the right formats and informats. If you already know what those formats and informats should be, you can always copy, paste and edit (from the log) the data step that resulted from the proc import run, adjusting any incorrect formats and informats and then just run it as a data step. Also, while I don't think it would make any difference, your proc import contains two "datafile=chr" statements. Art -------- On Tue, 19 Jan 2010 21:06:11 +0530, Cherish K <c4cherish@GMAIL.COM> wrote: >From MS SQL, I ext...

Re: Deleting SAS Data from a SAS DATASET #2
Chandra - this isn't my expertise area - I'm sure others may have better ideas but I'll make three comments. If your datasets have a large number of variables, in your datastep method a WHERE clause will be more efficient - the IF statement causes each record to be fully read before it can be selected for deletion. A WHERE clause would only read the single variable in the case of records that meet the criteria for deletion. Data prod.Master_date; set prod.master_date; where snap_dt ne "&end_dt"d; run; You probably would be better off changing your data model though - my first thought would to be to store your data as separate yearly or monthly files and then access them with a view of the past two years or 24 months. With each month or year you would delete the oldest file and change the view one time period forward. *set up the data; data time1 time2 time3 time4; do i = 1 to 100; do t = 1 to 4; if t=1 then output time1; if t=2 then output time2; if t=3 then output time3; if t=4 then output time4; end; end; run; *three successive example views; data filet1 / view=filet1; set time1 time2; run; data filet2 / view=filet2; set time2 time3; run; data filet3 / view=filet3; set time3 time4; run; One more thought - since the data are appended - if the file is not reordered and you have the record counts from each append - then you can use firsto...

Re: converting sas transport files into sas datasets
Once you have assigned an xport libname you can read it in like a normal dataset. libname out xport 'C:\Documents and Settings\kdt\Desktop\class.xpt'; *- Create xport file; data out.class; set sashelp.class; run; *- Create work file from xport file; data work.class; set out.class; run; 2008/12/17 <pramila.sami@gmail.com>: > Hello All, > > Could anyone please give me the code for converting sas transport > files into sas datasets. thanks in advance. > ...

Re: Is it possible to read a sas dataset NOT using sas?
You might try the Universal OLE DB driver. Docs at: http://tinyurl.com/2cmgcf Driver page at: http://tinyurl.com/2hbc23 I think this should allow you to read a sas data set but not write to it. Also, the driver does not support much beyond a Select * clause. Phil Rack www.minequest.com -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of RolandRB Sent: Tuesday, March 18, 2008 9:44 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Is it possible to read a sas dataset NOT using sas? Is it possible to read a sas dataset NOT using sas and have observations an...

Re: Autoexec.sas file Dm"pgm;zoom;"; doesnot wrk in SAS 9.2 #2
Hi Ace, The PGM is the editor window up through v6.12 but also still exists today. For the Enhanced Editor you can use: dm editor 'zoom' wedit ; Hope this is helpful. Mark Terjeson Investment Business Intelligence Investment Management & Research Russell Investments 253-439-2367 Russell Global Leaders in Multi-Manager Investing -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ace Sent: Wednesday, October 14, 2009 5:49 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Autoexec.sas file Dm"pgm;zoom;"; doesnot wrk in SAS...

Re: Reading in a SAS dataset #2
Cristian Proc Transpose will do this nicely Data RaterWide; input ID Rater1 Rater2 Rater3; cards; 00001 1 2 3 00002 4 5 6 run; Proc Transpose data = RaterWide Out = Skinny ( Rename = ( Col1 = Response _Name_ = Rater )) ; var Rater: ; * use any variable with the prefix of Rater; by id; run; Note that the variable Rater will have a label of _Name_. Nat Wooding -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of P. Cristian Gugiu Sent: Monday, January 04, 2010 1:21 PM To: SAS-L@L...

Re: how to read this file into sas #2
Read the file in its orginal form and Proc Transpose is one alternative... On Thu, 14 Sep 2006 17:09:52 -0700, liuyuanpku@GMAIL.COM wrote: >Hi, I just got a problem to read a txt file into sas. The structure of >the data in txt file is: > >family member >1 3809 3810 3811 3812 >2 3814 3815 3816 >3 3817 3818 3819 3820 > >When I read it into sas, I want it in the following structure: >family member >1 3809 >1 3810 >1 3811 >1 3812 >2 3814 >2 3815 >2 3816 >3 3817 >3 3818 >3 3819 >3 3820 > >How can I get this sas data? >Thank...

Re: urgent : Convert SAS array in to sas variables #2
On Sat, 3 May 2008 23:34:44 -0700, Shailesh <shailesh.tewari@GMAIL.COM> wrote: >In my dataset I have an array variable , say A which has values like >Observation 1 - A[1]= 23 ,A[2]=34, A[3]=45 >Observation 2 - A[11]= 23 ,A[12]=34, A[13]=45 > >I want to create sas variables which should have name A61, A62 , A63, >A64 .......... >Similarly for second observation these would be A71, A72, >A73 , A74......... > > >in the same datastep. > >Any help ? > >Regards, >Shailesh Arrays are DATA *step* structures. They do not exists in data *...

Re: SAS Macro to delete a SAS dataset #2 313487
I too like(d) PROC DELETE. When I used it I was forced to remove it and use PROC DATASETS because PROC DELETE is not documented. Also, but I have not tested it. How does it work with indexed data sets, audit trails, generation data groups, views, etc.? I don't worry much about deleting, "all" of my programs run in batch and are obsolete as soon as they are written. On 12/3/09, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <rjf2@cdc.gov> wrote: > > From: SAS Techies > > Subject: SAS Macro to delete a SAS dataset > > > > Here's a simple SAS...

Re: Ordering Variables in SAS Dataset #2
The SET and RETAIN statements are in the wrong order. On Thu, Mar 20, 2008 at 8:02 AM, DaDoctor <brett.a.summers@bankofamerica.com> wrote: > Fellow Members: > > I am working ordering a SAS dataset and thought I could use the retain > statement for this purpose. > > However, the process is bombing. > > syntax: > > data temp_dset; > set out.perm_dset; > retain var1 var2.........; > > run; > > > suggestions on what I am doing wrong? > ...

Re: Reading RTF files with SAS #2
Jake, I've never looked at the macro, but take a look at: www2.sas.com/proceedings/sugi31/066-31.pdf Art -------- On Wed, 18 Mar 2009 18:32:33 -0400, Jake <johbee@GMAIL.COM> wrote: >Does anyone know if SAS can read RTF files? The reason I need >to do this is to get a list of Titles from all the output in a bundled rtf >vs. doing it manually. > >Thanks, for any information (publications, etc) > >Jake ...

Re: SAS dataset to xpt file #2
Hi, Thank you very much for solving my problem. With Regards, Madan Gopal Kundu -----Original Message----- From: data _null_; [mailto:datanull@gmail.com] Sent: Saturday, June 10, 2006 6:56 PM To: Madan Gopal Kundu Cc: SAS-L@listserv.uga.edu Subject: Re: SAS dataset to xpt file Here is one way to create an export data library with more than one data set. Note that COPY will fail if there are character variables longer than 200, or dataset names are longer than 8. The VALIDVARNAME option facilitates truncation of variable names and labels. Run this example and study the log messages. It ...

Re: Reading PDF Files into SAS #2
Mona You have received several responses that speak of using some external tool to do a pdf to text conversion and then, presumably, you would parse the text with SAS. These responses depend on the PDF having been produced by a pdf writer and not by the file being a scanned image. In the later case, you would need to use an OCR reader to convert the pictures to text. Do you need to do only a few conversions or many and will this be an ongoing task? If you are only going to do an occasional conversion, I would use the Save As Text which is found in Adobe Acrobat Reader 7.0 and maybe earlier. However, if this is a larger project, I would (and have) used an external program to do the conversions. I have a paper from several years ago posted at http://www.vasug.org/Proceedings/2003-02/Presentations/EXTRACTING%20DATA%20FROM%20PDF%20FILES.doc This describes how I used a tool that converted one pdf at a time and controlled this from within the SAS program. Since that time, I have had a similar project and was not able to get the pdf converter that I used earlier to work. However, I found one available on line that converted all of the pdfs in a folder in one pass I was able to eliminate all of the SAS calls that ran the external process. I ran that particular job from home since there are restrictions on using unapproved tools here at work and I do not recall the name of the converter. Good luck. Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Ca...

how to read a xml-file into a SAS dataset #2
You have your table names backwards. This code works for me: libname testdata xml 'c:\temp\test.xml' ; proc copy in=testdata out=work ; select report ; run; Thanks, Alan Savian "Bridging SAS and Microsoft Technologies" ? nntp://news.qwest.net/comp.soft-sys.sas/ Hi, I am trying to read a xml-file into a SAS dataset. This is the datafile named loc_copy.xml: ---------------------------------------- GENEVA 61 HONG KONG 17 JOHANNESBURG 7 NEW YORK 92 I am running the following code: -------------------------------- libname xmlfile xml "d:\loc_copy.xml&qu...

Re: read excel files into SAS #2
A quick way to solve it is to use DDE, which you can specify the first row to be read as data and specify the informat as well. HTH. On 8/8/05, Joan Zhao <jlin104@hotmail.com> wrote: > I found a problem when I read a excel file into SAS. The initial seceral > rows(more than 8 rows) of one of the column in this file are blank and then > follwed by numeric numbers. In this column, most cells are empty. When SAS > read in this file by no matter what approach(SAS/ACCESS--import procedure > or OLEDB), nothing in this column is read in. The generated SAS dataset is > empty....

Re: Creating SAS datasets from reading a file
One approach would be to read the data into a large file and then create a new file with the unique state names. Then, use a step with call execute statements to built the SAS code for a step that would do the multiple outputs -- ie, mine without the infile and input statements. I use call execute infrequently but here is an example that I have in my tool box for when I need a refresher. Data MH_Data; set Scada_TagDesc; by file; string = compress(' '' '||put(mh_col,$4.)||' '' '); if first.file then call execute(' %doit( '||file||') ' ); if first.file then call execute( 'Data;set;if _name_ in(' ) ;* this is the first part of the next data step; if last.file = 0 then call execute( string || ',' );* write out intermediate cols that you want; if last.file then call execute( string || '); run; Proc Print; run;' ); * now, specify the last col to be selected and close the data step; run; Obviously, this is not what you need for your work but it should give you some ideas if you need them. Have a great weekend. Nat Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL. ...

Web resources about - Re: How to read a period in a variable from a file to SAS dataset #2 - comp.soft-sys.sas

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

Mozilla moves Firefox to variable release schedule
... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

When your environment variables are showing
There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 3/16/2016 10:43:44 PM