- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
dear all
i have the data in the following style
company_name | year | NIC |
20 Microns Ltd. | 2011 | 8 |
Ashapura Minechem Ltd. | 2011 | 8 |
A D F Foods Ltd. | 2011 | 10 |
Adani Wilmar Ltd. | 2011 | 10 |
Agro Tech Foods Ltd. | 2011 | 10 |
Ajanta Soya Ltd. | 2011 | 10 |
Ambar Protein Inds. Ltd. | 2011 | 10 |
Andrew Yule & Co. Ltd. | 2011 | 10 |
Arcuttipore Tea Co. Ltd. | 2011 | 10 |
Avanti Feeds Ltd. | 2011 | 10 |
B & A Ltd. | 2011 | 10 |
B C L Industries Ltd. | 2011 | 10 |
Bajaj Hindusthan Sugar Ltd. | 2011 | 10 |
Balrampur Chini Mills Ltd. | 2011 | 10 |
Bambino Agro Inds. Ltd. | 2011 | 10 |
Bannari Amman Sugars Ltd. | 2011 | 10 |
Bengal Tea & Fabrics Ltd. | 2011 | 10 |
Britannia Industries Ltd. | 2011 | 10 |
C C L Products (India) Ltd. | 2011 | 10 |
Chordia Food Products Ltd. | 2011 | 10 |
Coastal Corporation Ltd. | 2011 | 10 |
Coromandel Agro Products & Oils Ltd. | 2011 | 10 |
D C M Shriram Inds. Ltd. | 2011 | 10 |
D F M Foods Ltd. | 2011 | 10 |
Dalmia Bharat Sugar & Inds. Ltd. | 2011 | 10 |
Davangere Sugar Co. Ltd. | 2011 | 10 |
Dhampur Sugar Mills Ltd. | 2011 | 10 |
Dharani Sugars & Chemicals Ltd. | 2011 | 10 |
Dharti Proteins Ltd. | 2011 | 10 |
Diana Tea Co. Ltd. | 2011 | 10 |
Divya Jyoti Inds. Ltd. | 2011 | 10 |
Duncans Industries Ltd. | 2011 | 10 |
Dwarikesh Sugar Inds. Ltd. | 2011 | 10 |
E I D-Parry (India) Ltd. | 2011 | 10 |
Eastern Sugar & Inds. Ltd. | 2011 | 10 |
Empee Sugars & Chemicals Ltd. | 2011 | 10 |
Foods & Inns Ltd. | 2011 | 10 |
Hindustan Foods Ltd. | 2011 | 10 |
Kashipur Sugar Mills Ltd. | 2011 | 10 |
Kings Infra Ventures Ltd. | 2011 | 10 |
Kothari Fermentation & Biochem Ltd. | 2011 | 10 |
Madhur Industries Ltd. | 2011 | 10 |
Nimbus Foods Inds. Ltd. | 2011 | 10 |
Norben Tea & Exports Ltd. | 2011 | 10 |
Prima Agro Ltd. | 2011 | 10 |
Sagar Soya Products Ltd. | 2011 | 10 |
Sampre Nutritions Ltd. | 2011 | 10 |
Shah Foods Ltd. | 2011 | 10 |
Spectrum Foods Ltd. | 2011 | 10 |
Associated Alcohols & Breweries Ltd. | 2011 | 11 |
Devyani International Ltd. | 2011 | 11 |
Eco Friendly Food Processing Park Ltd. | 2011 | 11 |
Elegant Floriculture & Agrotech (India) Ltd. | 2011 | 11 |
Flex Foods Ltd. | 2011 | 11 |
G M Breweries Ltd. | 2011 | 11 |
G R M Overseas Ltd. | 2011 | 11 |
Naturite Agro Products Ltd. | 2011 | 11 |
Orient Beverages Ltd. | 2011 | 11 |
S I P Industries Ltd. | 2011 | 11 |
Sinnar Bidi Udyog Ltd. | 2011 | 11 |
Tarai Foods Ltd. | 2011 | 11 |
Freshtrop Fruits Ltd. | 2011 | 12 |
Sree Jayalakshmi Autospin Ltd. | 2011 | 12 |
A I Champdany Inds. Ltd. | 2011 | 13 |
A K Spintex Ltd. | 2011 | 13 |
A P M Industries Ltd. | 2011 | 13 |
Aarvee Denims & Exports Ltd. | 2011 | 13 |
Aditya Spinners Ltd. | 2011 | 13 |
Alka India Ltd. | 2011 | 13 |
Alok Industries Ltd. | 2011 | 13 |
Alps Industries Ltd. | 2011 | 13 |
Amarjothi Spinning Mills Ltd. | 2011 | 13 |
Ambika Cotton Mills Ltd. | 2011 | 13 |
Anjani Synthetics Ltd. | 2011 | 13 |
Arex Industries Ltd. | 2011 | 13 |
Arvind Ltd. | 2011 | 13 |
Asahi Industries Ltd. | 2011 | 13 |
Ashima Ltd. | 2011 | 13 |
Ashnoor Textile Mills Ltd. | 2011 | 13 |
B S L Ltd. | 2011 | 13 |
Bannari Amman Spg. Mills Ltd. | 2011 | 13 |
Banswara Syntex Ltd. | 2011 | 13 |
Betex India Ltd. | 2011 | 13 |
Bhandari Hosiery Exports Ltd. | 2011 | 13 |
Bharat Textiles & Proofing Inds. Ltd. | 2011 | 13 |
Binayak Tex Processors Ltd. | 2011 | 13 |
Birla Cotsyn (India) Ltd. | 2011 | 13 |
Birla Transasia Carpets Ltd. | 2011 | 13 |
Blue Blends (India) Ltd. | 2011 | 13 |
Budge Budge Co. Ltd. | 2011 | 13 |
C L C Industries Ltd. | 2011 | 13 |
Cheviot Co. Ltd. | 2011 | 13 |
Damodar Industries Ltd. | 2011 | 13 |
Dhanlaxmi Fabrics Ltd. | 2011 | 13 |
Donear Industries Ltd. | 2011 | 13 |
Eastern Silk Inds. Ltd. | 2011 | 13 |
Eskay K'N'It (India) Ltd. | 2011 | 13 |
Faze Three Autofab Ltd. | 2011 | 13 |
Faze Three Ltd. | 2011 | 13 |
the first variable is character variable and remaining two are numeric variables.
can anybody suggest me how to create data lines.
i tried with the below mentioned code, but it is not giving proper data structure as shown in the above table.
data have;
input company_name$ year NIC;
datalines;
run;
thanking you in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In my opinion, the easiest way to do this is to follow these instructions:
https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to insert the data after the DATALINES statement. Since you have blanks in the character column, you need to use a delimiter other than a blank, and add an INFILE DATALINES statement with the proper DLM= option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
could you please give me one sample code for this purpose
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I will not insult your intelligence by spoon-feeding you such simple code. Please try it yourself with the advice I already gave you (after 132 posts here, it can't be that hard any longer). Also consult the documentation of the INFILE Statement .
And add a LENGTH statement for company_name; the default length of 8 will be too short.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@srikanthyadav44 wrote:
dear Mr.KUrt_Bremser
could you please give me one sample code for this purpose
@maguiremq has provided an example of DATALINES in your other thread.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It is not clear what you are asking for. How is it that you have the data now?
Is it just in the tabular word file type structure you posted into your message? If so copy the lines and paste them after the DATALINES statement and before the statement with the semi-colon that ends the lines of in-line data. Then change any TAB characters that might be there to make it look like a table in WORD or EXCEL with some other more useful character, such as | or comma. For example in SAS Display Manager interactive usage you can just use the change command.
change '09'x '|' all
Then add an INFILE statement and make sure to define the first variable long enough (or give SAS a hint on how to GUESS what length to define).
data want;
infile datalines dsd dlm='|' truncover;
input company_name :$60. year NIC ;
datalines;
20 Microns Ltd.|2011|8
Ashapura Minechem Ltd.|2011|8
;
Is it already in a SAS dataset and you are asking how to generate text you could paste into the program to send to someone to recreate the data? Just use a data _NULL_ step and the PUT statement. Use a FILE statement so you can set a delimiter.
data _null_;
file log dsd dlm='|';
put company_name year nic;
run;
Then just copy the lines from the SAS log and paste them into your data step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
can you please let me know how to use
change '09'x '|' all
if i am using SAS on demand version.
thanking you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In SAS On Demand, you use SAS Studio, so the commands for the "old" editor of the Display Manager interface will not work.
But as long as your data does not contain tabs, using tabs as delimiters will be fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can do it with the GUI tools in SAS/Studio. You have to highlight and copy one of the tab characters from the program editor and paste it into the Find What box of the Find/Replace tool. It will just look like a bunch of spaces, but it works.
Example: Here is a program with tab characters:
And here you can seem them replaced with pipe characters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This macro will convert a dataset to a cards program: https://core.sasjs.io/mp__ds2cards_8sas.html