sas >> Reading data having space

by aarumugam » Sat, 28 Feb 2004 04:54:07 GMT

Is it possible to read the full name below, just by having on input
variable in the input statement. I tried different options. It did not
work.
Help please
This is the code.

data name;
*infile datalines dsd delimiter='';
input name $ char12.;
datalines;
John Smith
David Sheperd
Raj Singh
;

sas >> Reading data having space

by Harry.Droogendyk » Sat, 28 Feb 2004 05:02:35 GMT


Use the & informat modifier. Your input fields must then be separated by at
least two spaces.

data a;
input name & $char12.;
cards;
John Smith
George Brown
run;

-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ]On Behalf Of Anbu
Arasu
Sent: February 27, 2004 3:54 PM
To: XXXX@XXXXX.COM
Subject: Reading data having space


Is it possible to read the full name below, just by having on input
variable in the input statement. I tried different options. It did not
work.
Help please
This is the code.

data name;
*infile datalines dsd delimiter='';
input name $ char12.;
datalines;
John Smith
David Sheperd
Raj Singh
;

sas >> Reading data having space

by Nathaniel_Wooding » Mon, 01 Mar 2004 01:20:54 GMT

Anbu

Use the & format modifier as below in the input statement. This and a
couple other modifiers are described in the SAS Language section on
modified list input.

Nat Wooding

data name;

informat name $12.;
input name & ;
datalines;
John Smith
David Sheperd
Raj Singh
;
proc print;run;



Anbu Arasu
<aarumugam@STTHOM To: XXXX@XXXXX.COM
AS.EDU> cc:
Sent by: "SAS(r) Subject: Reading data having space
Discussion"
< XXXX@XXXXX.COM
GA.EDU>


02/27/04 03:54 PM
Please respond to
Anbu Arasu






Is it possible to read the full name below, just by having on input
variable in the input statement. I tried different options. It did not
work.
Help please
This is the code.

data name;
*infile datalines dsd delimiter='';
input name $ char12.;
datalines;
John Smith
David Sheperd
Raj Singh
;

sas >> Reading data having space

by nitin.chandak » Mon, 01 Mar 2004 12:13:04 GMT

Hi,
Use "&" sign after between name and informat.

Regards,

Nitin

data name;
*infile datalines dsd delimiter='';
input name $ & char12.;
datalines;
John Smith
David Sheperd
Raj Singh
;
run;


-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ]On Behalf Of Anbu
Arasu
Sent: Saturday, February 28, 2004 2:24 AM
To: XXXX@XXXXX.COM
Subject: Reading data having space


Is it possible to read the full name below, just by having on input
variable in the input statement. I tried different options. It did not
work.
Help please
This is the code.

data name;
*infile datalines dsd delimiter='';
input name $ char12.;
datalines;
John Smith
David Sheperd
Raj Singh
;

Similar Threads

1. Problem reading Excel data containing spaces w/ dde

2. having problem to read 2008 year?????

options yearcutoff= 1920;
data hosp ;
input @1  ID      2.
         @5  ADMIT   MMDDYY8.
         @19 DISCHRG MMDDYY8.
         @30 COST dollar8.;
		 format admit dischrg mmddyy10. cost dollar8.;
datalines;
78   03/23/2008    03/27/2008 12345
68   03/21/2008    03/24/2008 22345
98   04/23/2008    04/27/2008 42345
75   05/23/2008    05/27/2008 52345
56   03/02/2008    03/17/2008 62345
90   02/23/2008    02/27/2008 82345
45   04/23/2008    04/26/2008 72345
53   01/23/2008    01/27/2008 92345
67   03/23/2008    03/28/2008 11345
;
run;


But when I run this program, instead of 03/23/2008, I am getting
03/23/2002
Can somebody explain why, and give me the solution.

Any help or suggestion is appreciated.

3. Having trouble reading the pipe for the "set" command

4. reading delimited file with some records having two lines

Hi,
Is there anyone know how to use proc import to read in a delimited file
with some records having two lines?
Most of the records in the file just takes one line, but 3 or 4 of them
takes two lines and there is a '+' at the end of the first line to
separate it from the second line. What I'm doing now is manually removing
the '+' first and moving the second line to the end of the first line. Is
there a way for Proc import to recognize '+' sign and read in two lines as
one record?

Here is an shorted example of the raw data (the real data line is much
longer, having 50 variables)
-->first obs: (it takes only one line in raw data)
x|01|11|1901|2|x|.|2111|LOS ANGELES|CA|90007|(326) 391-2489|0

-->second obs:(it takes two lines in raw data, and using '+' sign to
separate the lines;
   -->first line:
   xxxx|01|01|1901|1|xxx|.|2555|LOS ANGELES|CA|90007|(326) 391-276+
   -->second line:
   3|0
Any help will be appreciated.

5. Reading messy space delimited files

6. pipe to read a directory with space

Hi there,

filename xx pipe "dir/b %sysfunc(pathname(WORK))\*.*";

data _null_;
infile xx;
input;
put _infile_;
run;

The above doesn't work, and I believe the reason is that the
directory name has spaces in it.
On DOS window, I can type in
dir/b "C:\WINNT\Temp\SAS Temporary Files\_TD2032\*.*" to get the list of
the files, but how I can add double quote in the pipe?

Thanks

Ya

7. Tell SAS to read leading/trailing blank space..?

8. how to read DOS directories which contain spaces

Group:

I have a problem reading DOS directories that contain spaces:
example code:

any ideas on this?


%let pdriver=C:\SasDev\pgm directories\p101 programs;

%let ddir=&pdriver||' ';

filename DIRLIST pipe "dir &ddir /s";

data _in_;

length dir_info $256;

infile dirlist length=reclen;

input dir_info $varying256. reclen;

run;