BookmarkSubscribeRSS Feed
mmaw
Fluorite | Level 6

Please review my code to see what I need to adjust in SAS Studio to make this recognize the variables in the code:

data paraquat;
input var rep $ timing yield protein seed;
datalines;
4 1 UTC 39.96198851 32.66 0.48
4 2 UTC 51.50817011 32.69 0.544
4 3 UTC 45.8398069 35.39 0.544
4 4 UTC 52.43472414 35.58 0.512
4 1 Early 23.28206897 30.31 0.352
4 2 Early 27.32986667 32.07 0.352
4 3 Early 26.73015172 32.55 0.352
4 4 Early 28.67690728 32.63 0.352
4 1 Mid 44.34293027 29.24 0.512
4 2 Mid 49.59247586 32.19 0.608
4 3 Mid 41.65812107 33.25 0.512
4 4 Mid 44.06625287 33.87 0.544
4 1 Late 61.39159847 33.16 0.48
4 2 Late 43.30928429 34.13 0.576
4 3 Late 40.82845977 34.4 0.576
4 4 Late 55.74122299 35.82 0.576
6 1 UTC 34.18555977 39.23 0.416
6 2 UTC 38.13813372 41.69 0.448
6 3 UTC 34.86190805 40.32 0.432
6 4 UTC 27.99318774 39.56 0.368
6 1 Early 26.01620536 35.01 0.336
6 2 Early 22.62992069 36.31 0.32
6 3 Early 25.7200567 35.59 0.288
6 4 Early 15.47464828 35.35 0.304
6 1 Mid 40.9208092 35.86 0.384
6 2 Mid 42.15584368 37.29 0.384
6 3 Mid 37.75645057 38.6 0.416
6 4 Mid 35.38670498 36.1 0.352
6 1 Late 27.59078161 40.01 0.4
6 2 Late 40.45804215 39.92 0.448
6 3 Late 38.01152414 41.09 0.4
6 4 Late 34.59807241 37.1 0.416

;
run; 

Thank you!!!!

5 REPLIES 5
ballardw
Super User

Your question talks about a log but no log is shown.

 

As a minimum you need something that will read the values of Timing. You do not indicate it is character so you are going to get invalid data for that variable.

A $ after the name of a variable on an input statement says to read the value as character with a maximum of 8 characters.

data paraquat;
	input var rep $ timing $ yield protein seed;							
	datalines;							
4	1	UTC	39.96198851	32.66	0.48
4	2	UTC	51.50817011	32.69	0.544
4	3	UTC	45.8398069	35.39	0.544
4	4	UTC	52.43472414	35.58	0.512
;

If there is something else of concern you need to state what the issue is.

If you did not what REP to be character then remove the $ after Rep on the input statement.

 

 

mmaw
Fluorite | Level 6
Thank you for your quick response to my inquiry! Transitioning to SAS Studio is a bit trickier/different on the coding I am finding.
Kurt_Bremser
Super User

@mmaw wrote:
Thank you for your quick response to my inquiry! Transitioning to SAS Studio is a bit trickier/different on the coding I am finding.

The SAS system is the same, so the code works the same, no matter if you use Display Manager, Enterprise Guide or SAS Studio. The code to read from DATALINES in particular will be absolutely the same.

data_null__
Jade | Level 19

@mmaw wrote:
Thank you for your quick response to my inquiry! Transitioning to SAS Studio is a bit trickier/different on the coding I am finding.

Where you using EG or DM before?

data_null__
Jade | Level 19

Your data is tab delimited.  Use INFILE DSD DLM='09'x option or INFILE EXPANDTABS option.

 

data paraquat;
   infile cards dsd dlm='09'x;
    input var rep timing $ yield protein seed;							
	datalines;							
4	1	UTC	39.96198851	32.66	0.48
4	2	UTC	51.50817011	32.69	0.544
4	3	UTC	45.8398069	35.39	0.544
4	4	UTC	52.43472414	35.58	0.512
4	1	Early	23.28206897	30.31	0.352
4	2	Early	27.32986667	32.07	0.352
4	3	Early	26.73015172	32.55	0.352
4	4	Early	28.67690728	32.63	0.352
4	1	Mid	44.34293027	29.24	0.512
4	2	Mid	49.59247586	32.19	0.608
4	3	Mid	41.65812107	33.25	0.512
4	4	Mid	44.06625287	33.87	0.544
4	1	Late	61.39159847	33.16	0.48
4	2	Late	43.30928429	34.13	0.576
4	3	Late	40.82845977	34.4	0.576
4	4	Late	55.74122299	35.82	0.576
6	1	UTC	34.18555977	39.23	0.416
6	2	UTC	38.13813372	41.69	0.448
6	3	UTC	34.86190805	40.32	0.432
6	4	UTC	27.99318774	39.56	0.368
6	1	Early	26.01620536	35.01	0.336
6	2	Early	22.62992069	36.31	0.32
6	3	Early	25.7200567	35.59	0.288
6	4	Early	15.47464828	35.35	0.304
6	1	Mid	40.9208092	35.86	0.384
6	2	Mid	42.15584368	37.29	0.384
6	3	Mid	37.75645057	38.6	0.416
6	4	Mid	35.38670498	36.1	0.352
6	1	Late	27.59078161	40.01	0.4
6	2	Late	40.45804215	39.92	0.448
6	3	Late	38.01152414	41.09	0.4
6	4	Late	34.59807241	37.1	0.416
;
run; 

 

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1048 views
  • 0 likes
  • 4 in conversation