How to get any kind of data in SAS? Is it possible to take
data from notepad in SAS?

Answers were Sorted based on User's Feedback



How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / sas29

Data sample_accounts;
INPUT Account 1-7 OpenDate $ 9-17 StatusCode $ 21-22
CreditLimit 25-29;
CARDS;
1234670 11-Sep-04 Z 2000
1234671 12-Sep-04 3000
1234672 13-Sep-04 Z 2500
1234673 14-Sep-04 T 3200
1234674 15-Sep-04 8000
run;


method1
--------------------------
Data sample_accounts;
INFILE "C:\Mydata\sample_accounts.txt";
INPUT Account 1-7 OpenDate $ 9-17 StatusCode $ 21-22
CreditLimit 25-29;
RUN;

method 2
-----------------------------------
filename sacc "D:\Mydata\sample_accounts.txt";
Data sample_accounts;
INFILE sacc ;
INPUT Account 1-7 OpenDate $ 9-17 StatusCode $ 21-22
CreditLimit 25-29;
RUN;

method 3;
use proc import:

method 4:
use proc cimport for xpt files into sas

Is This Answer Correct ?    28 Yes 0 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / vasu

we can get the data into sas environment but while getting
the data into sas environment we should keep in mind that
whether the data is in alligined in proper order if not
then use some softwarw like edit plus.
After that we can get the data into sas by the following
ways
1. using datalines
2.using infile statement
3.using dde triplet
uing any one of the above we can get the any kind of
relational or non-relational data into sas.

Is This Answer Correct ?    5 Yes 4 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / krishna

yes . By using infile statement and options like dlm ,dsd
missover, trunover ,firstobs ,obs

Is This Answer Correct ?    1 Yes 0 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / mr.b

Data sample_accounts;
INFILE "C:\Mydata\sample_accounts.txt";
INPUT Account 1-7 OpenDate $ 9-17 StatusCode $ 21-22
CreditLimit 25-29;
RUN;
tis will be as i know.

Is This Answer Correct ?    1 Yes 0 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / krishna

In base sas
we can data from external data by

data <datasetname>;
infile 'path\file.txt';
run;

by procedure

proc import datafile='path\file.xls' out=<datasetname>
dbms=excel;
sheet='sheetname';
run;

proc import table=tablename out=<datasetname>
dbms=access;
database='path\file.mdb';
run;

Is This Answer Correct ?    0 Yes 0 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / naveen

Data sample_accounts;
INPUT Account 1-7 OpenDate $ 9-17 StatusCode $ 21-22
CreditLimit 25-29;
CARDS;
1234670 11-Sep-04 Z 2000
1234671 12-Sep-04 3000
1234672 13-Sep-04 Z 2500
1234673 14-Sep-04 T 3200
1234674 15-Sep-04 8000
run;

filename myfile "C:\Mydata\sample_accounts.txt";
data qqq;
infile myfile dlm=' ';
input Account OpenDate $ StatusCode $ CreditLimit;
run;

Is This Answer Correct ?    0 Yes 0 No

How to get any kind of data in SAS? Is it possible to take data from notepad in SAS?..

Answer / nsb

Yes, we can read the data from notepad just like reading
data from from any other file formats by using INFILE
statement.

infile "...\....\xyz.txt";

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SAS Interview Questions

what are the methods that you would employ to fine tune your SQL extract process using SAS/Access or Proc SQL?

1 Answers  


How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? How do you test for missing values? How would you create multiple observations from a single observation? What are some good SAS programming practices for processing very large data sets? Briefly describe 5 ways to do a "table lookup" in SAS. Why is SAS considered self-documenting? Are you sensitive to code walk-throughs, peer review, or QC review? What other SAS features do you use for error trapping and data validation? How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?

2 Answers  


Describe the function and utility of the most difficult SAS macro that you have written?

0 Answers   Oracle,


what is the formula to measure Baseline

3 Answers   Sristek,


How is character variable converted into numeric variable and vice versa?

0 Answers  


what is picture format? give any one example?

3 Answers   Parexel,


Given an unsorted data set, how to read the last observation to a new data set?

0 Answers  


We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge the data according to age in file B

3 Answers  


Explain the use of proc gplot? : sas-grid-administration

0 Answers  


What versions of SAS have you used (on which platforms)?

0 Answers   Quintiles,


What is auto call macro and how to create a auto call macro? What is the use of it? How to use it in sas with macros? : sas-macro

0 Answers  


How would you determine how far down on a page you have printed in order to print out footnotes?

3 Answers  


Categories